0

I want to make a python query for API Authentication token but am not getting any response.

The curl request on the website is like this

curl -X "POST" "https://integrations.apptopia.com/api/login" \
       -H "Content-Type: application/x-www-form-urlencoded" \
       --data-urlencode "client=<client>" \
       --data-urlencode "secret=<secret>"

where credentials are like this

client: XXXXXXXXXX

secret: XXXXXXXXXXXXXXXX

I want a python query for this to get JSON Token

I have tried following :

import requests
url = "https://integrations.apptopia.com/api/login"
payload = {
    'client': "XXXXXXXXXXXXX",
    'secret': "XXXXXXXXXXXXXXXXXXX"
    }

headers = {
    'Content-Type': "application/x-www-form-urlencoded"
    }
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)

But I am getting no response from this code. Please help me out.

  • I can't check what you expect to see if login success, but when login fails your code working properly `print(response.text)` → `{"error":"Auth Error"}`. Is there any response text at all? Try to check status instead: `response.status_code` or try to use `session` and check if cookies set after successful login https://stackoverflow.com/questions/25091976/python-requests-get-cookies – rzlvmp May 27 '21 at 05:33

0 Answers0