mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-28 14:39:07 +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
|
|
@ -7,6 +7,7 @@ from __future__ import annotations
|
|||
import json
|
||||
import sys
|
||||
import typing as t
|
||||
from http import HTTPStatus
|
||||
|
||||
from ansible.module_utils.basic import env_fallback
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
|
@ -60,7 +61,12 @@ class Response:
|
|||
|
||||
@property
|
||||
def ok(self):
|
||||
return self.status_code in (200, 201, 202, 204)
|
||||
return self.status_code in (
|
||||
HTTPStatus.OK,
|
||||
HTTPStatus.CREATED,
|
||||
HTTPStatus.ACCEPTED,
|
||||
HTTPStatus.NO_CONTENT,
|
||||
)
|
||||
|
||||
|
||||
class Online:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue