Last active
January 14, 2021 23:50
-
-
Save tk421/1ecc41f6df4dfdb7fbf3bc6ddca334c5 to your computer and use it in GitHub Desktop.
Skydesks API V2 Python Example
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
#!/usr/bin/env python3 | |
import requests | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
token = "my_secret_token" | |
subscription_id = "25399" | |
data = {"server_name": "ICMarkets-Demo04", "account_number" : "44140905", "account_password" : "my_secret_password", "callback_url": "https://test-skydesks.free.beeceptor.com/"} | |
url = "https://api.skydesks.com/v2/subscriptions/%s/actions/login" % subscription_id | |
headers = { "Accept": "application/json", "Authorization": "Bearer %s" % token } | |
r = requests.post(url, data=data, headers=headers, timeout=90) | |
if int(r.status_code) == 200: | |
logging.info("Successful: %s" % (r.text)) | |
else: | |
logging.warning("Failed with code %s: %s" % (r.status_code, r.text)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment