ESP8266 text processing


#1

Hi, I’m wanting to access a webpage (it’s actually a txt page) and I want to pick out a particular numerical value within the text and then use that to control a neopixel strip. The problem I’m having is that although I can do this in Python I can’t find a way of doing it in MicroPython or indeed in Arduino IDE, which are what I assume I would use with an ESP8266 device. The code I use in Python is

while True:
try:
f = urllib.request.urlopen(“http://aurorawatch.lancs.ac.uk/api/0.1/activity.txt”)
lines = f.readlines()
x = lines[31]
n = x[32:-7]
a = float(n)
z = int(a)
print(’{:%Y-%m-%d %H:%M:%S}’.format(datetime.datetime.now()),’,’,z)

Can anyone please tell me how I could achieve this in Micropython or Arduino IDE?

Thanks

Andrew