Examples

# Required package requests: `pip install requests`

import json
import base64
import requests
                    
# Using of Client Credentials authorization flow.
# Insert your client credentials received in welcome email.

client_id = "your_client_id"
client_secret = "your_client_secret"

identity_url = "https://id.livevol.com/connect/token"
api_url = "https://api.livevol.com/v1/delayed/allaccess/market/underlying-quotes?symbols=AAPL&date=2019-01-18"

authorization_token  = base64.b64encode((client_id + ':' + client_secret).encode())
headers = {"Authorization": "Basic " + authorization_token.decode('ascii')}
payload = {"grant_type": "client_credentials"}

# Requesting access token
token_data = requests.post(identity_url, data=payload, headers=headers)

if token_data.status_code == 200:
    access_token = token_data.json()['access_token']
    if len(access_token) > 0:
        print("Authenticated successfully")
        
		# Requesting data from API
        result = requests.get(api_url, headers={"Authorization": "Bearer " + access_token})
        print(result.json())
else:
    print("Authentication failed")