Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

API Tokens

  • Some services require the negotiation of an access token for each session when accessing an API.

  • This process typically consists of

    • a first call to the API with a user ID and passphrase/secret/password,

    • retreiving a token,

    • using the token in subsequent queries to the API.

BarentsWatch

  • The following is an example based on BartensWatch’s API.

  • client_id is the combination of an email address and a client name (see BarentsWatch API tutorial).

  • client_secret is a password connected to the client name.

Convenience functions

  • We create two functions for easily requesting a token and data from the API (see API_Tokens.py).

  • These are based on the GitHub repository of BarentsWatch

Token request successful
False
<Figure size 640x480 with 1 Axes>