diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2021-11-02 18:14:59 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2021-11-02 18:14:59 -0700 |
commit | 31d1a6a713d177990609767d508209ced19ca396 (patch) | |
tree | a628a57bdb373669394a6b520102b1b4b5ffe7da /python/fatcat_tools/api_auth.py | |
parent | 9dc891b8098542bb089c8c47098b60a8beb76a53 (diff) | |
download | fatcat-31d1a6a713d177990609767d508209ced19ca396.tar.gz fatcat-31d1a6a713d177990609767d508209ced19ca396.zip |
fmt (black): fatcat_tools/
Diffstat (limited to 'python/fatcat_tools/api_auth.py')
-rw-r--r-- | python/fatcat_tools/api_auth.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/python/fatcat_tools/api_auth.py b/python/fatcat_tools/api_auth.py index bbf059c0..d8f0c46d 100644 --- a/python/fatcat_tools/api_auth.py +++ b/python/fatcat_tools/api_auth.py @@ -1,4 +1,3 @@ - import os import sys @@ -15,6 +14,7 @@ def public_api(host_uri): conf.host = host_uri return fatcat_openapi_client.DefaultApi(fatcat_openapi_client.ApiClient(conf)) + def authenticated_api(host_uri, token=None): """ Note: if this helper is called, it's implied that an actual API connection @@ -24,10 +24,11 @@ def authenticated_api(host_uri, token=None): conf = fatcat_openapi_client.Configuration() conf.host = host_uri if not token: - token = os.environ['FATCAT_API_AUTH_TOKEN'] + token = os.environ["FATCAT_API_AUTH_TOKEN"] if not token: sys.stderr.write( - 'This client requires a fatcat API token (eg, in env var FATCAT_API_AUTH_TOKEN)\n') + "This client requires a fatcat API token (eg, in env var FATCAT_API_AUTH_TOKEN)\n" + ) sys.exit(-1) conf.api_key["Authorization"] = token |