mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
replace literal HTTP codes with http.HTTPStatus (#11561)
* replace literal HTTP codes with http.HTTPStatus * add changelog frag
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import urllib.error as urllib_error
|
||||
from http import HTTPStatus
|
||||
from urllib.parse import urlencode
|
||||
|
||||
from ansible.module_utils.basic import json
|
||||
@@ -93,7 +94,7 @@ def check_zone_domain(data, domain):
|
||||
"""
|
||||
exists = False
|
||||
|
||||
if data.status_code in [201, 200]:
|
||||
if data.status_code in (HTTPStatus.CREATED, HTTPStatus.OK):
|
||||
for zone_domain in data.json():
|
||||
if zone_domain["domain"] == domain:
|
||||
exists = True
|
||||
@@ -108,7 +109,7 @@ def check_zone(data, name):
|
||||
counter = 0
|
||||
exists = False
|
||||
|
||||
if data.status_code in [201, 200]:
|
||||
if data.status_code in (HTTPStatus.CREATED, HTTPStatus.OK):
|
||||
for zone in data.json():
|
||||
if zone["nickname"] == name:
|
||||
counter += 1
|
||||
|
||||
Reference in New Issue
Block a user