Created
February 12, 2014 01:25
-
-
Save adam-stokes/8948180 to your computer and use it in GitHub Desktop.
python websocket over wss
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/python3 | |
from ws4py.client.threadedclient import WebSocketClient | |
from pprint import pprint | |
import json | |
params = {} | |
params['Type'] = "Admin" | |
params['Request'] = 'Login' | |
params['RequestId'] = 1 | |
params['Params'] = {'AuthTag': 'user-admin', | |
'Password': '211fdd69b8942c10cef6cfb8a4748fa4' } | |
class Stupid(WebSocketClient): | |
def opened(self): | |
self.send(json.dumps(params)) | |
def closed(self, code, reason): | |
print(("Closed", code, reason)) | |
def received_message(self, m): | |
print(("Message", json.loads(m.data.decode('utf-8')))) | |
if __name__ == '__main__': | |
ws = Stupid('wss://10.0.3.1:17070/', protocols=['https-only']) | |
ws.daemon = False | |
ws.connect() | |
info = {'Type': 'Client', | |
'Request': 'EnvironmentInfo'} | |
ws.send(json.dumps(info)) | |
ws.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment