- Code: Select all
import requests
# output from gmcmap.com looks like this:
# {"time": "2019-08-04 10:44:53", "CPM": "19", "ACPM": "18.22", "uSv": "0.12"}
result = requests.get("http://www.gmcmap.com/historyData-plain.asp?Param_ID=68108722812")
lines = result.text.split(',')
words = lines[1].split(":")
cpm_value = words[1].replace('"','').replace(' ','')
indigo.variable.updateValue(385534937, cpm_value)
That gets rid of all the double-quotes and the space that's in the string.