mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Fixed import of urlencode and pathname2url from urllib for python3 (#24424)
This commit is contained in:
@@ -289,10 +289,9 @@ except ImportError:
|
||||
# Let snippet from module_utils/basic.py return a proper error in this case
|
||||
pass
|
||||
|
||||
import urllib
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
|
||||
@@ -449,7 +448,7 @@ class CloudflareAPI(object):
|
||||
name = self.zone
|
||||
param = ''
|
||||
if name:
|
||||
param = '?' + urllib.urlencode({'name' : name})
|
||||
param = '?' + urlencode({'name' : name})
|
||||
zones,status = self._cf_api_call('/zones' + param)
|
||||
return zones
|
||||
|
||||
@@ -475,7 +474,7 @@ class CloudflareAPI(object):
|
||||
if value:
|
||||
query['content'] = value
|
||||
if query:
|
||||
api_call += '?' + urllib.urlencode(query)
|
||||
api_call += '?' + urlencode(query)
|
||||
|
||||
records,status = self._cf_api_call(api_call)
|
||||
return records
|
||||
|
||||
@@ -154,7 +154,7 @@ EXAMPLES = '''
|
||||
# DNSMadeEasy module specific support methods.
|
||||
#
|
||||
|
||||
import urllib
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||
|
||||
IMPORT_ERROR = None
|
||||
try:
|
||||
@@ -204,7 +204,7 @@ class DME2:
|
||||
def query(self, resource, method, data=None):
|
||||
url = self.baseurl + resource
|
||||
if data and not isinstance(data, basestring):
|
||||
data = urllib.urlencode(data)
|
||||
data = urlencode(data)
|
||||
|
||||
response, info = fetch_url(self.module, url, data=data, method=method, headers=self._headers())
|
||||
if info['status'] not in (200, 201, 204):
|
||||
|
||||
Reference in New Issue
Block a user