juju api and authenticated request
Adam Stokes
adam.stokes at ubuntu.com
Mon Feb 10 18:02:37 UTC 2014
I tried a python3 variant that uses ws4py which is RFC 6455 compliant
and can not seem to get the login to work:
# OUtput
connection opened
{'RequestId': 1, 'Response': {}}
# Code
#!/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':
'f0d44f279b47cc8b5f7ea291f5e3b30a'}
class DummyClient(WebSocketClient):
def opened(self):
print("connection opened")
self.send(json.dumps(params))
def closed(self, code, reason):
print ("Closed down", code, reason)
def received_message(self, m):
pprint(json.loads(m.data.decode('utf-8')))
return m
if __name__ == '__main__':
try:
ws = DummyClient('wss://192.168.122.16:17070/',
protocols=['https-only'])
ws.connect()
# info = {'Type': 'Client',
# 'Request': 'EnvironmentInfo'}
# ws.send(json.dumps(info))
except KeyboardInterrupt:
ws.close()
The library that Kapil uses in the jujuclient only supports hybi-13.
So I'm curious if juju supports anything beyond that?
--
[ Adam Stokes ]
More information about the Juju
mailing list