ESP8266-01 from Python to Micropython
Posted: Fri Apr 02, 2021 4:44 pm
Hi everybody,
new to the forum and seek help!
struggling with attempt to port to ESP-01 few lines of RPi Python code I wrote long time ago.
The code is expected to send an event alert to Pushover and it works (so far).
I'm 'lost in translation' due to "httplib" which seems is missing in Micropython.
Any clue how to solve it?
thanks a lot for any kind of advice
scroogie
new to the forum and seek help!
struggling with attempt to port to ESP-01 few lines of RPi Python code I wrote long time ago.
The code is expected to send an event alert to Pushover and it works (so far).
I'm 'lost in translation' due to "httplib" which seems is missing in Micropython.
Any clue how to solve it?
thanks a lot for any kind of advice
scroogie
Code: Select all
if GPIO.input(4):
msg = "CLOSED"
entry = entry + "," + msg + "," + "\n"
csv = open(filename, 'a')
print ("CLOSED")
GPIO.output(3, 1)
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.urlencode({
"token": "yyyyyyyyyyyy",
"user": "xxxxxxxxxxx",
"message": "OPEN :)",
"sound": "pushover",
}), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()
csv.write(entry)
csv.close()