Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Viable HTTP(s) and MQTT Libs for WiPy?

    Scheduled Pinned Locked Moved MicroPython
    5 Posts 3 Posters 3.2k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      gbozzi
      last edited by

      Hi,

      I would like to use a minimalist http lib and mutt lib that supports TLS (nice to have, cert-check).
      I need it to interact mostly with REST APIs.

      I tested urlib from Lucien2K

      https://github.com/micropython/micropython-lib/tree/master/urllib.urequest

      With mixed results.
      A good test-bed is mockbin (http://mockbin.org) where one can create an end-point and test all libs features (e.g. HTTP headers, payload...).

      Using urlib against Mockbin gives a socket 411 error, I have an idea why this happens but that's perhaps the subject for another discussion ;-)

      =================================
      Gabriele Bozzi
      "At the mousetrap of life, the second mouse gets the cheese! And not the third. The secret of the fast follower is to be fast and selective"

      1 Reply Last reply Reply Quote 0
      • R Offline
        Roberto
        last edited by

        Hello gbozzi,

        I would recommend using the mqtt library form the micro python libraries
        mqtt.simple:
        https://github.com/micropython/micropython-lib/tree/master/umqtt.simple

        mqtt.robust:
        https://github.com/micropython/micropython-lib/tree/master/umqtt.robust

        They are both Memory efficiency and well supported by the micro python community.

        There are lot of other useful libraries at the root of the repo here

        For HTTPS base your work on the ssl module, for more information go to:
        https://docs.pycom.io/wipy/library/ussl.html#module-ussl

        1 Reply Last reply Reply Quote 1
        • G Offline
          gbozzi
          last edited by

          THX @Roberto

          I forked the Urequests lib I mentioned in my first post, added JSON support and fixed some minor issues.
          In case someone is more comfortable with requests:

          https://github.com/Enabling/wipy-urllib/tree/master

          =================================
          Gabriele Bozzi
          "At the mousetrap of life, the second mouse gets the cheese! And not the third. The secret of the fast follower is to be fast and selective"

          R 1 Reply Last reply Reply Quote 0
          • R Offline
            Roberto @gbozzi
            last edited by

            @gbozzi
            Thanks for the initiative, we appreciate the community contributions a lot.
            I'll be following your repo. I hope that you find the mqtt libraries useful.

            Best Regards
            Roberto Marques

            1 Reply Last reply Reply Quote 0
            • F Offline
              flemlion
              last edited by

              We've found umqtt.simple to work fine without SSL, but if you want to use MQTTS on the WiPy, then a small modification is needed, as you can find here:
              https://github.com/Enabling/WiPy-LoPy/tree/master/SensorLib/mqtt

              1 Reply Last reply Reply Quote 1

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • 1 / 1
              • First post
                Last post

              Pycom on Twitter

              Pycom