From 0f5add556b398f3c5be21f7c7e9f0081321adc5d Mon Sep 17 00:00:00 2001 From: Tom Morrell Date: Thu, 26 Sep 2024 09:54:03 -0700 Subject: [PATCH] Formatting --- caltechdata_api/cli.py | 10 +++++++--- outdated/test_community.py | 22 +++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/caltechdata_api/cli.py b/caltechdata_api/cli.py index ed4a7a6..c9c3eb9 100644 --- a/caltechdata_api/cli.py +++ b/caltechdata_api/cli.py @@ -62,7 +62,7 @@ def decrypt_token(encrypted_token, key): # Function to get or set token def get_or_set_token(production=True): key = load_or_generate_key() - + # Use different token files for production and test environments token_filename = "token.txt" if production else "token_test.txt" token_file = os.path.join(caltechdata_directory, token_filename) @@ -74,8 +74,12 @@ def get_or_set_token(production=True): return token except FileNotFoundError: while True: - token = input(f"Enter your {'Production' if production else 'Test'} CaltechDATA token: ").strip() - confirm_token = input(f"Confirm your {'Production' if production else 'Test'} CaltechDATA token: ").strip() + token = input( + f"Enter your {'Production' if production else 'Test'} CaltechDATA token: " + ).strip() + confirm_token = input( + f"Confirm your {'Production' if production else 'Test'} CaltechDATA token: " + ).strip() if token == confirm_token: encrypted_token = encrypt_token(token, key) with open(token_file, "wb") as f: diff --git a/outdated/test_community.py b/outdated/test_community.py index a718785..9639231 100644 --- a/outdated/test_community.py +++ b/outdated/test_community.py @@ -5,24 +5,20 @@ url = "https://data.caltechlibrary.dev/" headers = { - "Authorization": "Bearer %s" % token, - "Content-type": "application/json", - } - -data = { - "payload": { - "content": "I want this record to be in!", - "format": "html" - } + "Authorization": "Bearer %s" % token, + "Content-type": "application/json", } +data = {"payload": {"content": "I want this record to be in!", "format": "html"}} + result = requests.post( - url + "/api/records/cxc6m-bef55/draft/actions/submit-review", headers=headers, json=data - ) + url + "/api/records/cxc6m-bef55/draft/actions/submit-review", + headers=headers, + json=data, +) print(result.status_code) print(result.text) -#if result.status_code != 201: +# if result.status_code != 201: # print(result.text) # exit() -