bgp

- research & experiments with border gateway protocol
git clone git://git.acid.vegas/bgp.git
Log | Files | Refs | Archive | README

ris-live.py (445B)

      1 import json
      2 
      3 try:
      4 	import websocket
      5 except ImportError:
      6 	raise SystemExit('missing websocket-client')
      7 
      8 ws = websocket.WebSocket()
      9 ws.connect('wss://ris-live.ripe.net/v1/ws/?client=bgpexample')
     10 
     11 params = {
     12 	'moreSpecific': True,
     13 	'host': 'rrc21',
     14 	'socketOptions': {
     15 		'includeRaw': True
     16 	}
     17 }
     18 
     19 ws.send(json.dumps({
     20 		'type': 'ris_subscribe',
     21 		'data': params
     22 }))
     23 
     24 for data in ws:
     25 	parsed = json.loads(data)
     26 	print(parsed['type'], parsed['data'])