Skip to content

Commit

Permalink
Fix token file
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorrell committed May 1, 2024
1 parent f9e2561 commit d93ee58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions caltechdata_api/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def decrypt_token(encrypted_token, key):
# Function to get or set token
def get_or_set_token():
key = load_or_generate_key()
token_file = os.path.join(caltechdata_directory, "token.txt")
try:
token = os.path.join(caltechdata_directory, "token.txt")
with open(token, "rb") as f:
with open(token_file, "rb") as f:
encrypted_token = f.read()
token = decrypt_token(encrypted_token, key)
return token
Expand All @@ -73,7 +73,7 @@ def get_or_set_token():
confirm_token = input("Confirm your CaltechDATA token: ").strip()
if token == confirm_token:
encrypted_token = encrypt_token(token, key)
with open("token.txt", "wb") as f:
with open(token_file, "wb") as f:
f.write(encrypted_token)
return token
else:
Expand Down

0 comments on commit d93ee58

Please sign in to comment.