Example Code

Example Code

This article gives sample code for using the Firebird API.

Fetching Access Token using Python

This example describes the authentication process using example credentials. See Authenticating with the API for more details.

The examples in this article use the fictitious Deep Space Mining 2025 Project which you are free to use for testing the API.

#!/usr/bin/env python3

import requests

if __name__ == '__main__':

client_id = '9H6L92EHXFZBR0UCN8CXYHOBVDZQB7JDQQUWOS1A'

tokens_url = 'https://flame.firebird.systems/token'
authentication_data = {
    'grant_type': 'client_credentials',
    'client_id': client_id,
}
authentication_headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
}

response = requests.post(
    tokens_url,
    authentication_data,
    headers=authentication_headers,
)

token = reponse.json().get('access_token')

Comments