Skip to main content

An SDK for EarthScope API

Project description

EarthScope SDK

An SDK for authenticating with the EarthScope API

Getting Started

USAGE

  1. (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
    
  2. Install earthscope-sdk

    pip install earthscope-sdk
    

    For developers:

    pip -e install earthscope-sdk[dev]
    
  3. 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 tokens
    • save_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, and scope.

    For ClientCredentialsFlow:

    • audience, client_credentials, and domain.

      where client_credentials contains the machine-to-machine client_id and client_secret.

    These values are all obtained from Auth0.

  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

earthscope-sdk-0.1.0.tar.gz (15.5 kB view hashes)

Uploaded Source

Built Distribution

earthscope_sdk-0.1.0-py3-none-any.whl (15.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page