diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml new file mode 100644 index 0000000..81e6a94 --- /dev/null +++ b/.github/workflows/black.yaml @@ -0,0 +1,10 @@ +name: Lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: psf/black@stable diff --git a/caltechdata_api/cli.py b/caltechdata_api/cli.py index e63db47..2286497 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 with support for test system 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() -