mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-26 13:42:49 +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
|
|
@ -76,10 +76,10 @@ class IpifyFacts(object):
|
|||
result = {
|
||||
'ipify_public_ip': None
|
||||
}
|
||||
(response, info) = fetch_url(module=module, url=self.api_url + "?format=json", force=True, timeout=self.timeout)
|
||||
(response, info) = fetch_url(module=module, url=f"{self.api_url}?format=json", force=True, timeout=self.timeout)
|
||||
|
||||
if not response:
|
||||
module.fail_json(msg="No valid or no response from url %s within %s seconds (timeout)" % (self.api_url, self.timeout))
|
||||
module.fail_json(msg=f"No valid or no response from url {self.api_url} within {self.timeout} seconds (timeout)")
|
||||
|
||||
data = json.loads(to_text(response.read()))
|
||||
result['ipify_public_ip'] = data.get('ip')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue