I'm just starting with web2py and python, I am trying to utilize a rest web service using Requests, the call goes through ok and I get the appropriate data back but I am having trouble finding information on how to parse the response to a field. i.e. assigning customer name to a variable. Most examples just print the .json() return data.
import requests
Controller Code:
url = 'http://services/myRestService/OrderInformation/?$top=1'
r = requests.get(url,headers = headers, auth=('testuser','testuser'))
results = r.json()
customername = ?
Results:
{u'd': {u'results': [{u'OrderNumber': u' 159', u'__metadata': {u'type': u'OrderInformation', u'id': u"http://127.0.0.1/services/OrderInformation('%20%20%20%20%20159')", u'uri': u"http://127.0.0.1/services/OrderInformation('%20%20%20%20%20159')"}, u'OrderDate': u'4/12/2012 12:00:00 AM', u'CustomerNumber': u'901 ', u'CustomerName': u’Coffee Outlet '}], u'__next': u'http://127.0.0.1/services/OrderInformation/?$select=CustomerName,CustomerNumber,OrderNumber,OrderDate%20'}}