mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-17 17:31:31 +00:00
modules ip*: use f-strings (#10968)
* modules ip*: use f-strings * add changelog frag
This commit is contained in:
parent
0ef2235929
commit
0b6e99b28b
13 changed files with 80 additions and 73 deletions
|
|
@ -239,15 +239,14 @@ class IpbaseInfo(object):
|
|||
})
|
||||
|
||||
if info['status'] != 200:
|
||||
self.module.fail_json(msg='The API request to ipbase.com returned an error status code {0}'.format(info['status']))
|
||||
self.module.fail_json(msg=f"The API request to ipbase.com returned an error status code {info['status']}")
|
||||
else:
|
||||
try:
|
||||
content = response.read()
|
||||
result = self.module.from_json(content.decode('utf8'))
|
||||
except ValueError:
|
||||
self.module.fail_json(
|
||||
msg='Failed to parse the ipbase.com response: '
|
||||
'{0} {1}'.format(url, content))
|
||||
msg=f'Failed to parse the ipbase.com response: {url} {content}')
|
||||
else:
|
||||
return result
|
||||
|
||||
|
|
@ -274,7 +273,7 @@ class IpbaseInfo(object):
|
|||
params['language'] = language
|
||||
|
||||
if params:
|
||||
url += '?' + urlencode(params)
|
||||
url += f"?{urlencode(params)}"
|
||||
|
||||
return self._get_url_data(url)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue