Last active
October 1, 2016 20:04
-
-
Save 013/5707aab9ef8bd22ab603 to your computer and use it in GitHub Desktop.
Sky Router SR102 Connect/Disconnect Script
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/python | |
import base64 | |
import requests | |
skyrouter = "10.0.0.2" | |
userpass = "admin:sky" | |
# http://en.wikipedia.org/wiki/Basic_access_authentication#Client_side | |
b64userpass = base64.b64encode(userpass) | |
def reboot(action): | |
url = "http://%s/sky_st_poe.sky" % skyrouter | |
params = {'todo': action} | |
headers = {'Authorization' : 'Basic %s' % b64userpass, 'Credentials' : userpass} | |
r = requests.post(url, headers=headers, params=params) | |
print r.status_code | |
print r.text | |
def main(): | |
reboot('disconnect') | |
reboot('connect') | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment