[MicroPython] Add urllib.parse to base firmware to enable web services
-
I am currently playing around with some web services and libraries, it mostly fails because most of those MicroPython programs require
urllib.parseto be installed, mostly forurlencode().It would be great to get urllib.parse and its dependencies into the base firmware image.
Cheers
Mike -
Adding
upipto the firmware image would make developer's live much easier.How to manually install the
urllib.parselibrary.Create folder
/upipand add files upip.py and upip_utarfile.py manually.Install the library with upip:
%cd /flash/upip import upip upip.install("micropython-urllib.parse", "/flash/lib")To get it working, remove
re.pyandffilib.pyfromlib. Hat-tip to Andreas.Finally you can encode URL parameters for GET requests:
%cd /flash/lib import urllib.parse urllib.parse.urlencode({"a":1, "b": 2}) => 'a=1&b=2'
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