Skip to content

Instantly share code, notes, and snippets.

@013
Last active October 1, 2016 20:04
Show Gist options
  • Save 013/5707aab9ef8bd22ab603 to your computer and use it in GitHub Desktop.
Save 013/5707aab9ef8bd22ab603 to your computer and use it in GitHub Desktop.
Sky Router SR102 Connect/Disconnect Script
#!/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