So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By scroogie
#91014 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()