From 00432d18023b49fce9ea59c94ebb5674173673ba Mon Sep 17 00:00:00 2001 From: aeluce Date: Thu, 3 Feb 2022 15:44:33 -0600 Subject: [PATCH] remove access_token query parameters --- python/create_export.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/python/create_export.py b/python/create_export.py index c6d4dcb..a0fc01c 100755 --- a/python/create_export.py +++ b/python/create_export.py @@ -34,7 +34,7 @@ # -- End Script Configuration -- - +HEADERS = {"Authorization": "Bearer {}".format(ACCESS_TOKEN)} SPINNER = itertools.cycle(["|", "/", "-", "\\"]) @@ -61,14 +61,14 @@ def main(): def create_export(export_type, start_time, end_time): """Request a new export""" - url = api_url("/v3/merchants/" + MERCHANT_ID + "/exports/") + url = HOST + "/v3/merchants/" + MERCHANT_ID + "/exports/" payload = { "type": export_type, "startTime": start_time, "endTime": end_time, } - resp = requests.post(url, json=payload) + resp = requests.post(url, json=payload, headers=HEADERS) resp.raise_for_status() return resp.json() @@ -76,9 +76,9 @@ def create_export(export_type, start_time, end_time): def get_export(export_id): """Get the current state of the specified export""" - url = api_url("/v3/merchants/" + MERCHANT_ID + "/exports/" + export_id) + url = HOST + "/v3/merchants/" + MERCHANT_ID + "/exports/" + export_id - resp = requests.get(url) + resp = requests.get(url, headers=HEADERS) resp.raise_for_status() return resp.json() @@ -129,11 +129,6 @@ def download_exported_data(export_urls): print("") -def api_url(resource_path): - """Generate the URL for an API call""" - return "{}{}?access_token={}".format(HOST, resource_path, ACCESS_TOKEN) - - def print_export(export, label): """Pretty print the export""" print("")