Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import sys
- import json
- import requests
- def main():
- username = input("Wink Email: ")
- password = input("Wink Password: ")
- post(username, password)
- def post(username, password):
- url = "https://winkapi.quirky.com/oauth2/token"
- headers = {"Content-Type": "application/json"}
- payload = {
- "client_id": "quirky_wink_android_app",
- "client_secret": "e749124ad386a5a35c0ab554a4f2c045",
- "email": username,
- "password": password,
- "grant_type": "password"
- }
- result = requests.post(url, params=payload, headers=headers)
- if result.status_code < 205:
- json_results = json.loads(result.text)
- sys.stdout.write(
- "access_token: " + json_results["access_token"] + "\nrefresh_token: " + json_results["refresh_token"] + "\n");
- else:
- sys.stdout.write(result.text + "\n")
- sys.stdout.write("Error getting bearer token")
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement