json - get value from function using python -
i have python function.
def v(): response = urllib2.urlopen('https://api.gosquared.com/v2/concurrents?api_key=xxxxx&site_token=xxxx&presenter=old') data = json.load(response) print data
and have firebase
f = firebase('https://xxxxx.firebaseio.com/channel/1/status/viewers') r = f.update({'viewers': 'v()'})
i want value of key:value pair returned value v() function.
i've tried 'v()', "v()", , v() no avail.
what not understanding correctly?
your function should return
value. it's printing , not returning nything
try this:
def v(): response = urllib2.urlopen('https://api.gosquared.com/v2/concurrents?api_key=xxxxx&site_token=xxxx&presenter=old') data = json.load(response) #comment below line if don't want print data , want return print data return data
update: if want store returned data variable then:
returned_data = v()
Comments
Post a Comment