use f-string

master
Aevann1 2022-06-18 00:14:27 +02:00
parent 0b0e3454f8
commit 28fa03669d
1 changed files with 2 additions and 2 deletions

View File

@ -251,7 +251,7 @@ def api_comment(v):
copyfile(oldname, filename) copyfile(oldname, filename)
process_image(v.patron, filename, 200) process_image(v.patron, filename, 200)
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS,
data='{"files": ["https://%s/assets/images/badges/%s.webp"]}' % (request.host, badge.id), timeout=5) data=f'{{"files": ["https://{request.host}/assets/images/badges/{badge.id}.webp"]}}', timeout=5)
except Exception as e: except Exception as e:
return {"error": str(e)}, 400 return {"error": str(e)}, 400
elif v.admin_level > 2 and parent_post.id == 37838: elif v.admin_level > 2 and parent_post.id == 37838:
@ -286,7 +286,7 @@ def api_comment(v):
badge_grant(badge_id=17, user=user) badge_grant(badge_id=17, user=user)
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS,
data='{"files": ["https://%s/e/%s.webp"]}' % (request.host, name), timeout=5) data=f'{{"files": ["https://{request.host}/e/{name}.webp"]}}', timeout=5)
cache.delete_memoized(marsey_list) cache.delete_memoized(marsey_list)
except Exception as e: except Exception as e: