Skip to content

Instantly share code, notes, and snippets.

@SpotlightKid
SpotlightKid / test.sh
Last active October 9, 2023 21:31
Making a POST request with url or form-encoded params with MicroPython
$ micropython uget.py key1=value1 key2=value2 key2=value3
{'url': 'http://httpbin.org/get?key2=value3&key1=value1', 'headers': {'Host': 'httpbin.org', 'Connection': 'close'}, 'args': {'key2': 'value3', 'key1': 'value1'}, 'origin': 'XXX.XXX.XXX.XXX'}
$ micropython upost.py foo=bar spamm=42
{'files': {}, 'headers': {'Host': 'httpbin.org', 'Content-Length': '16', 'Content-Type': 'application/x-www-form-urlencoded', 'Connection': 'close'}, 'args': {}, 'form': {'spamm': '42', 'foo': 'bar'}, 'origin': 'XXX.XXX.XXX.XXX', 'data': '', 'json': None, 'url': 'http://httpbin.org/post'}