mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-03 08:52:55 +00:00
modules [t-z]*: use f-strings (#10978)
* modules [t-z]*: use f-strings * add changelog frag * remove extraneous file
This commit is contained in:
parent
af246f8de3
commit
adcc683da7
45 changed files with 514 additions and 536 deletions
|
|
@ -96,9 +96,9 @@ def send_message(module, client_id, client_secret, topic, msg):
|
|||
"""
|
||||
try:
|
||||
access_token = get_access_token(module, client_id, client_secret)
|
||||
url = 'https://typetalk.com/api/v1/topics/%d' % topic
|
||||
url = f'https://typetalk.com/api/v1/topics/{topic}'
|
||||
headers = {
|
||||
'Authorization': 'Bearer %s' % access_token,
|
||||
'Authorization': f'Bearer {access_token}',
|
||||
}
|
||||
do_request(module, url, {'message': msg}, headers)
|
||||
return True, {'access_token': access_token}
|
||||
|
|
@ -128,7 +128,7 @@ def main():
|
|||
|
||||
res, error = send_message(module, client_id, client_secret, topic, msg)
|
||||
if not res:
|
||||
module.fail_json(msg='fail to send message with response code %s' % error.code)
|
||||
module.fail_json(msg=f'fail to send message with response code {error.code}')
|
||||
|
||||
module.exit_json(changed=True, topic=topic, msg=msg)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue