auth
index
/Users/samuelveliveli/Downloads/marine-tracker/src/auth.py

Optional Movebank credentials, loaded from environment variables.
 
Movebank's live tracking API (www.movebank.org/movebank/service/direct-read)
requires HTTP Basic Auth on every request, including study discovery -- there
is no anonymous tier. If MOVEBANK_USERNAME and MOVEBANK_PASSWORD are not set,
callers should fall back to the Movebank Data Repository (a separate, fully
public, DOI-archival system used by ingest.py for historical studies).
 
Credentials are read from a local .env file (via python-dotenv) or from the
shell environment. Never hardcode credentials in source.

 
Modules
       
os

 
Functions
       
get_auth()
Return a (username, password) tuple suitable for requests' `auth=` kwarg, or None.
 
Returns None when no credentials are configured, signaling callers to use
the public Data Repository fallback instead of the live API.
get_credentials()
Return (username, password) from the environment, or (None, None) if unset.
has_live_credentials()
Return True if both MOVEBANK_USERNAME and MOVEBANK_PASSWORD are set and non-empty.