Hi,
   I am using REST- API of Ryu to get flow status in a python code as below.

The returned values are in Unicode and if I need to use them in my program,
I could not do it. I tried to decode it using decode('utf-8') but it is
giving error as:
.'dict' object has no attribute 'decode'

I want to push new flow rules if the byte count exceeds certain values from
rest api.
Can I do it by reading the byte count from rest api as below.
How to use the returned values in my code if they are in Unicode.

test.py
import requests
import json
import urllib2
url  = "http://localhost:8080/stats/aggregateflow/130341408620355";
res = json.loads(urllib2.urlopen(url).read())

for key, v in res.iteritems():
      print key, v

output:
130341408620355 [{u'packet_count': 105278, u'byte_count': 22622753,
u'flow_count': 4}]

Thanks
Gandhimathi
------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a 
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to