mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-22 05:09:12 +00:00
[PR #11561/7436c0c9 backport][stable-12] replace literal HTTP codes with http.HTTPStatus (#11568)
replace literal HTTP codes with `http.HTTPStatus` (#11561)
* replace literal HTTP codes with http.HTTPStatus
* add changelog frag
(cherry picked from commit 7436c0c9ba)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
b3782a76e0
commit
25c475a7ef
18 changed files with 135 additions and 78 deletions
|
|
@ -6,6 +6,7 @@ from __future__ import annotations
|
|||
|
||||
import json
|
||||
import typing as t
|
||||
from http import HTTPStatus
|
||||
|
||||
from ansible.module_utils.basic import env_fallback
|
||||
from ansible.module_utils.urls import basic_auth_header, fetch_url
|
||||
|
|
@ -56,7 +57,7 @@ class BitbucketHelper:
|
|||
headers=headers,
|
||||
)
|
||||
|
||||
if info["status"] == 200:
|
||||
if info["status"] == HTTPStatus.OK:
|
||||
self.access_token = content["access_token"]
|
||||
else:
|
||||
self.module.fail_json(msg=f"Failed to retrieve access token: {info}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue