Skip to content

Instantly share code, notes, and snippets.

@CnrLwlss CnrLwlss/testlock.py
Last active Sep 18, 2017

Embed
What would you like to do?
Attempt to consume ResortLock webservices
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()
@CnrLwlss

This comment has been minimized.

Copy link
Owner Author

commented Sep 18, 2017

Authorisation response from server: {"access_token":"#####","token_type":"bearer","expires_in":7199,"created_at":1505724759}
Pin response from server:

<!DOCTYPE html>
<html>
<body>
<h1>404</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.