Commit f47522b2 authored by Christophe Benz's avatar Christophe Benz
Browse files

Auth via headers instead of query param

parent 6505e10f
......@@ -95,6 +95,10 @@ def main():
log.error("Please set WTO_API_KEY environment variable before using this script !")
return 1
requests_session.headers.update({
'Ocp-Apim-Subscription-Key': api_key,
})
log.info("- Downloading metadata...")
# Download categories
write_json_file(target_dir / 'categories.json',
......@@ -177,7 +181,7 @@ def main():
def get_from_api(api_request):
api_request += "&subscription-key={}".format(api_key)
global requests_session
response = requests_session.get(api_request, timeout=REQUEST_TIMEOUT)
response.raise_for_status()
return json.loads(response.content)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment