-->
Page 1 of 1

ESP8266-01 from Python to Micropython

PostPosted: Fri Apr 02, 2021 4:44 pm
by scroogie
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

Code: Select allif 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()

Re: ESP8266-01 from Python to Micropython

PostPosted: Sun Apr 11, 2021 7:26 am
by scroogie
did I post in the wrong session?
140 views and no comments... :?

Re: ESP8266-01 from Python to Micropython

PostPosted: Wed Apr 14, 2021 3:17 am
by QuickFix
I guess Python/µPython knowledge is sparse here; I don't speak it, so can't help you I'm afraid, sorry. :cry:

Re: ESP8266-01 from Python to Micropython

PostPosted: Wed Apr 14, 2021 8:54 am
by scroogie
thanks QickFix for your comment: at least I feel less alone!! ;)