Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorrell committed Sep 26, 2024
1 parent 079020d commit 0f5add5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
10 changes: 7 additions & 3 deletions caltechdata_api/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
22 changes: 9 additions & 13 deletions outdated/test_community.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 0f5add5

Please sign in to comment.