i have a working ESP32 project, the project started 2022, with Micropython Ver1.18. the project fetches the web to get the current location and the correct time and the correct time zone according to the location. (code listed below)
def getLocation():
global lng,lat,acu,udf
headers = {“Content-Type”: “application/json”}
locationStr = “https://www.googleapis.com/geolocation/v1/geolocate?key=” + APIKey
try:
response = urequests.post(locationStr, headers=headers, data=ujson.dumps(data))
location = ujson.loads(response.content)
lng = location[“location”][“lng”]
lat = location[“location”][“lat”]
acu = location[“accuracy”]
print (“the current Location is lat %s, Log %s with accuracy %s” % (lat,lng,acu))
response.close()
except:
print(“unable to read the current location %s” %OSError)
Both Micropython versions downloaded from here https://micropython.org/download/ESP32_GENERIC/
and i am using windows 11 with Thonny 4.1.4
As mentioned earlier, the program is working fine since 2022. i decide to upgrade the program to Micropython Ver 1.22. After updating the MicroPython to the new release. the program Breaks down with Memory Error 16 at “urequest.post” command. when I change the “https” to “http” in locationStr variable, the program doesn’t break but return an error saying the server support https only.
is anyone faced this or has an explanation?
thanks in advance
I tried to reduce the program to the min size but i didn’t succussed
Ahmed Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.