Im trying to make a request to the API:https://www.trakomatic.com/
Code used:
import requests
url = 'https://webapi.trakomatic.com/....'
head1 = {'Authorization': 'access_token 066bf0a8d74xxxx'}
head2 = {'Authorization': '066bf0a8d74xxxx'}
head3 = {'Authorization': 'Token : 066bf0a8d74xxxx'}
head4 = {"Token":"066bf0a8d74xxxx"}
response = requests.post(url, headers= head3)
The API requires a token to make an HTTP request.Currently I am using the token provided by the API, perhaps is expiring. I am getting the following error.
>>>response.text
u'{"Status":"ERROR","Message":"Invalid or NULL token","Data":null}'
>>>response
<Response [200]>
I have tried various formats of the header,as I suspected it maybe the cause but to no avail. Is there a way where I can use the username and password to generate the token? Is there something wrong with what I am doing?
The authentication page of the API has this:
URL Format[web api server]/account/authenticate/
URLhttps://webapi.trakomatic.com/account/authenticate/
Parameter(s){ LoginName: , Password: }
Tried using requests:
from requests.auth import HTTPBasicAuth
u = 'xxx'
p = 'xxx'
>>>
a=requests.post('https://webapi.trakomatic.com/account/authenticate/', auth=HTTPBasicAuth('u', 'p'))
>>> a
<Response [200]>
>>> a.json()
{u'Status': u'ERROR', u'LoginName': None, u'CorporationId': 0, u'Token': None, u'Msg': u'Invalid information to login', u'Password': None}