<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[MicroPython] Add urllib.parse to base firmware to enable web services]]></title><description><![CDATA[<p dir="auto">I am currently playing around with some web services and libraries, it mostly fails because most of those  MicroPython programs require <code>urllib.parse</code> to be installed, mostly for <code>urlencode()</code>.</p>
<p dir="auto">It would be great to get <a href="https://github.com/micropython/micropython-lib/tree/master/urllib.parse" target="_blank" rel="noopener noreferrer nofollow ugc">urllib.parse</a> and its dependencies into the base firmware image.</p>
<p dir="auto">Cheers<br />
Mike</p>
]]></description><link>https://community.m5stack.com/topic/2926/micropython-add-urllib-parse-to-base-firmware-to-enable-web-services</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Mar 2026 00:10:17 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2926.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 09 Feb 2021 20:52:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [MicroPython] Add urllib.parse to base firmware to enable web services on Tue, 09 Feb 2021 21:37:16 GMT]]></title><description><![CDATA[<p dir="auto"><strong>Adding <code>upip</code> to the firmware image would make developer's live much easier.</strong></p>
<p dir="auto">How to manually install the <code>urllib.parse</code> library.</p>
<p dir="auto">Create folder <code>/upip</code> and add files <a href="https://github.com/micropython/micropython-lib/blob/master/upip/upip.py" target="_blank" rel="noopener noreferrer nofollow ugc">upip.py</a> and <a href="https://github.com/micropython/micropython-lib/blob/master/upip/upip_utarfile.py" target="_blank" rel="noopener noreferrer nofollow ugc">upip_utarfile.py</a> manually.</p>
<p dir="auto">Install the library with upip:</p>
<pre><code>%cd /flash/upip
import upip
upip.install("micropython-urllib.parse", "/flash/lib")
</code></pre>
<p dir="auto">To get it working, remove <code>re.py</code> and <code>ffilib.py</code> from <code>lib</code>. Hat-tip to <a href="https://forum.pycom.io/topic/4494/how-to-use-libpcre-on-the-pycom-micropython-runtime/2" target="_blank" rel="noopener noreferrer nofollow ugc">Andreas</a>.</p>
<p dir="auto">Finally you can encode URL parameters for GET requests:</p>
<pre><code>%cd /flash/lib
import urllib.parse
urllib.parse.urlencode({"a":1, "b": 2})

=&gt; 'a=1&amp;b=2'
</code></pre>
]]></description><link>https://community.m5stack.com/post/12392</link><guid isPermaLink="true">https://community.m5stack.com/post/12392</guid><dc:creator><![CDATA[mb]]></dc:creator><pubDate>Tue, 09 Feb 2021 21:37:16 GMT</pubDate></item></channel></rss>