0

I have to use either requests or urllib3 with app ID and app token in python, in curl I am using like below and it is work

 curl -X POST "https://someurl/" -H "accept: application/json" -H "App-ID: app-id-xxxx" -H "Auth-Token: app-token-secret" -H "Content-Type: application/json" -d "body"

In python it is suggested urllib3 or requests, but i am not sure how i need to authenitcate, I have found out couple of links but is for basic authentication

Basic authentication:

authentication with urllib3

Below link has only token secret and no token id

python request with authentication (access_token)

Can anyone help me to pass/authenticate with app id and app token

Selcuk
  • 57,004
  • 12
  • 102
  • 110
asteroid4u
  • 125
  • 1
  • 12

1 Answers1

0

You should simply add them to the headers dictionary:

response = requests.post('https://someurl', data,
    headers={'accept': 'application/json',
             'App-ID': 'app-id-xxxx', 
             'Auth-Token': 'app-token-secret',
             'Content-Type': 'application/json' })
Selcuk
  • 57,004
  • 12
  • 102
  • 110