An SDK for EarthScope API
Project description
EarthScope SDK
An SDK for authenticating with the EarthScope API
Getting Started
USAGE
-
(Optional) Suggest setting up and activating a python virtual environment so as not to clutter your system python
python3 -m venv venv . venv/bin/activate
-
Install earthscope-sdk
pip install earthscope-sdk
For developers:
pip -e install earthscope-sdk[dev]
-
Create required subclasses
To use the Device Authorization Flow you will need to create a subclass of the DeviceCodeFlow class. Similarly, to use the Machine-to-Machine Client Credentials Flow you will need to create a subclass of the ClientCredientialFlow class. Implementing the following methods in the subclass is required:
load_tokens
should implement the ability to load saved tokenssave_tokens
should implement the ability to save tokens locally
additionally for DeviceCodeFlow only:
prompt_user
should provide the user with the SSO authorization uri
You will need to instantiate your subclass with the following instance attributes:
For DeviceCodeFlow:
audience
,domain
,client_id
, andscope
.
For ClientCredentialsFlow:
-
audience
,client_credentials
, anddomain
.where client_credentials contains the machine-to-machine
client_id
andclient_secret
.
These values are all obtained from Auth0.
-
Use the SDK
You can now use the subclasses to define actions such as logging in/out, retrieving or refreshing access tokens, etc...
Additionally, once your subclasses have been instantiated, you can use your access token to retrieve your user information as well as anonymous user information using the earthscope_sdk.user.user functions.
To see an example of an application using this SDK, check out the EarthScope CLI GitLab.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for earthscope_sdk-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e720ddcb0c4186ec01f3a491a317f37ff0dae4fa68c220b259c987e0dfa2e395 |
|
MD5 | 5d2afa9bf5dd49b8e23f5af291c4b83b |
|
BLAKE2b-256 | 2240e755dc4ad7106fc6badf213971af9c24a748208dc866ed0068ee1c0d3478 |