Issue with curl
Posted: Sun Aug 26, 2018 9:40 am
Hi,
here is the configuration I use:
Lilygo T4 board with ESP32 and SPIRAM
MicroPython ESP32_LoBo_v3.2.20 - 2018-06-28 on ESP32 board with ESP32
I use curl to get a json file from wunderground weather forecast using their API
res[0] returns 0
and res[2] contains the json data
The problem is that some characters are modified leading to an error when res[2] is parsed with ujson.loads(res[2])
I have investigated to understand where the problem is
I found that in res[2] there are . (ASCII 46) When I substitute a space to the . the string is parsed without error
In a console, I ran a:I opened the file with GHEX
There are tabs in the file where I find . in res[2].
Where are those . coming from?
As far as I understand, the curl module in loboris version is the same as the one in official MicroPython.
here is the configuration I use:
Lilygo T4 board with ESP32 and SPIRAM
MicroPython ESP32_LoBo_v3.2.20 - 2018-06-28 on ESP32 board with ESP32
I use curl to get a json file from wunderground weather forecast using their API
Code: Select all
import curl, ujson
res=curl.get('http://api.wunderground.com/api/my_access_key/conditions/lang:FR/q/pws:ILEDEFRA179.json')
objjson = ujson.loads(res[2])
and res[2] contains the json data
The problem is that some characters are modified leading to an error when res[2] is parsed with ujson.loads(res[2])
I have investigated to understand where the problem is
I found that in res[2] there are . (ASCII 46) When I substitute a space to the . the string is parsed without error
In a console, I ran a:
Code: Select all
GET -o text http://api.wunderground.com/api/my_access_key/conditions/lang:FR/q/pws:ILEDEFRA179.json > conditions.txt
Where are those . coming from?
As far as I understand, the curl module in loboris version is the same as the one in official MicroPython.