ameerabdulaziz
ameerabdulaziz

Reputation: 25

How to connect to HTTPS connection to use an API in Python?

This is the requirement from the API's documentation

This is the Curl command of getting the clients in their documentation

curl -i -X GET -H "X-KEYALI-API:{API_KEY}" -u {API_USERNAME}:{API_PASSWORD} https://aliphia.com/v1/api_public/clients/

So, I need to implement the same thing in Python

Upvotes: 0

Views: 402

Answers (1)

Or Y
Or Y

Reputation: 2118

import requests

headers = {
    'X-KEYALI-API': '{API_KEY}',
}

response = requests.get('https://aliphia.com/v1/api_public/clients/', headers=headers, auth=('{API_USERNAME}', '{API_PASSWORD}'))

Upvotes: 1

Related Questions