Skip to content

Instantly share code, notes, and snippets.

@CnrLwlss
Last active September 18, 2017 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CnrLwlss/e1ee5de7c3b7878bf02b9d3d6b803a42 to your computer and use it in GitHub Desktop.
Save CnrLwlss/e1ee5de7c3b7878bf02b9d3d6b803a42 to your computer and use it in GitHub Desktop.
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
Copy link
Author

CnrLwlss 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