Skip to content

Instantly share code, notes, and snippets.

@isaacgr
Created June 2, 2019 22:21
Show Gist options
  • Save isaacgr/4273d86102e21bb9fccbbbfdcf840c03 to your computer and use it in GitHub Desktop.
Save isaacgr/4273d86102e21bb9fccbbbfdcf840c03 to your computer and use it in GitHub Desktop.
Script to test that my janus server is actually up and running.
import requests
janus_ip = '192.168.2.48'
msg = {
'janus': 'create',
'transaction': 'test'
}
r = requests.post('http://%s/janus' % janus_ip, json=msg)
d = r.json()
print d
_id = d['data']['id']
print 'id: %s' % (_id)
msg = {
"janus":"attach",
"plugin":"janus.plugin.streaming",
"opaquedc_ip, id":"streamingtest-XN0N0H2zN3Ic",
"transaction":"nWiJ5VaHrIvR",
}
r = requests.post('http://%s/janus/%d' % (janus_ip, _id,), json=msg)
d = r.json()
handle = d['data']['id']
print 'handle: %s' % (handle)
msg = {
"janus": "message",
"body": {
"request": "list"
},
"transaction": "Q7SpRB8mvbfa"
}
r = requests.post('http://%s/janus/%d/%d' % (janus_ip, _id, handle,), json=msg)
d = r.json()
print 'Mount points: %r' % d['plugindata']['data']['list']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment