-
Notifications
You must be signed in to change notification settings - Fork 0
Tokens
Matthew Dowdell edited this page Jan 25, 2017
·
7 revisions
Many of the actions made available by the API require a CSRF token. If a token is required, the request body for a particular action will include a token key. POST and PUT requests require tokens, while GET requests do not. Tokens obtained through this method will expire 10 minutes after creation or when they are used, irrespective of whether the request resulted in an error or not.
To obtain a token, send a POST request to /v1/tokens.
The response to this request if no errors occur will be:
{
"token": "$token"
}import requests
server = 'http://sensly.io/v1%s'
resp = requests.post(server % '/tokens')
print resp.json()