Last active
September 18, 2017 09:04
-
-
Save CnrLwlss/e1ee5de7c3b7878bf02b9d3d6b803a42 to your computer and use it in GitHub Desktop.
Attempt to consume ResortLock webservices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
authDict = {'client_id':'#####', | |
'client_secret':'#####', | |
'grant_type':'client_credentials'} | |
authRes = requests.post('https://connect.devicewebmanager.com/oauth/token',json=authDict) | |
print 'Authorisation response from server: ' + authRes.text | |
authFromServer = authRes.json() | |
pinDict = { | |
"access_token": authFromServer['access_token'], | |
"attributes": { | |
"resort_lock_id": "ba02ce97-f08d-4cb9-99b5-358bf169068c", | |
"name": "Ann Smith", | |
"starts_at": "2020-01-02T13:00:00", | |
"ends_at": "2021-01-02T16:00:00", | |
"email": "meredith@bode.org" | |
} | |
} | |
head = {"Authorization":"access_token "+authFromServer['access_token'], | |
"Content-Type":"application/x-www-form-urlencoded" | |
} | |
pinRes = requests.post('https://connect.devicewebmanager.com/resort_lock_guests',json=pinDict,headers=head) | |
print 'Pin response from server: ' + pinRes.text | |
pinFromServer = pinRes.json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Authorisation response from server: {"access_token":"#####","token_type":"bearer","expires_in":7199,"created_at":1505724759}
Pin response from server: