Solution: Coming from PHP Print_r but it's done differently in Python and much easier
print s['STATUS'][0]['Description'] On Monday, January 27, 2014 4:06:01 PM UTC-6, David wrote: > > Ok I've spent several hours trying to understand how Python/Web2Py can > pull a piece of data from a json response but it is still eluding me. > > Could someone be so kind enough to show me the python way of handling this > response so I can put a piece of data on the screen from a remote host? > > Situation: > > I have a remote host that I have a python module for that allows me to > query it to do things and get responses. I'd like to incorporate some of > those responses into a view using real time data responses. > > When I execute a simple "get version info" the beautiful vars follows: > > STATUS:Code:22Description:cgminer 3.1.1Msg:CGMiner versionsSTATUS:SWhen: > 1390859661VERSION:API:1.25CGMiner:3.1.1id:1 > How would I obtain the part "API : 1.25" using python? > > At this point I am stabbing around in the dark and don't understand what I > don't understand. > > I've got {{=response._vars['version']}} but it gives me "Key Error" > > If you have or know of a good newbie tutorial I should read about it I > would also be thankful. > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.