[SOLVED] urequests + redirects
Re: [SOLVED] urequests + redirects
... no idea for urequests + redirects ???
-
- Posts: 463
- Joined: Wed Apr 08, 2015 5:19 am
Re: [SOLVED] urequests + redirects
Here, I fixed it for ya:meebox wrote: ↑Tue Dec 01, 2020 11:51 amCan you show me how to use this library in MicroPython? I get error showing me the ussl module doesn't have the SSLContext method.Thanks.mcauser wrote: ↑Fri May 31, 2019 8:42 amIt’s moved here:
https://github.com/pfalcon/micropython- ... /urequests
https://gist.github.com/SpotlightKid/86 ... 41dd269c44
Tested it on an ESP32 with pre-built firmware version esp32-idf3-20210118-unstable-v1.13-274-g49dd9ba1a.bin:
I renamed the module to 'prequests.py', because the current MicroPython firmware for the ESP32 already has an "urequest" module built in, but that does not support redirects and you can't overwrite it with a module file with the same name.
Code: Select all
$ mpy-cross prequests.py
$ rshell -p /dev/ttyUSB0 cp requests.mpy /pyboard
$ rshell -p /dev/ttyUSB0 repl
>>> import prequests
>>> # note NO trailing slash => triggers a redirect to 'https://chrisarndt.de/impressum/'
>>> r = prequests.get('https://chrisarndt.de/impressum')
>>> print(r.text[:100])
-
- Posts: 463
- Joined: Wed Apr 08, 2015 5:19 am
Re: [SOLVED] urequests + redirects
Sure, but even a (preferably strict) subset of httpx - like using features already provided by prequests - would be useful.SpotlightKid wrote: ↑Mon Jan 18, 2021 11:22 pmThis would be unlikely to succeed. httpx has a current LOC of 7553 (LLOC: 3244) and depends on half a dozen other Python modules.
It may be worth noting that the requests and httpx modules are in roughly the same ballpark of size.
-
- Posts: 463
- Joined: Wed Apr 08, 2015 5:19 am
Re: [SOLVED] urequests + redirects
Yeah, and neither would fit on an MicroPython board without serious reworking ("urequest.py" has not much in common with "requests" except the name and the module-level function names). At which point it is easier to (re-)implement the features you need from them.
Feel free to prove me wrong by porting it.
Feel free to prove me wrong by porting it.
Re: [SOLVED] urequests + redirects
Thanks, I try it tomorrow..
I want send data to google spreadsheet.. .
I want send data to google spreadsheet.. .
Re: [SOLVED] urequests + redirects
Super ... yes .. working .. perfect .. super .. thanks ..
Send data to Google SpreadSheet and return back answer from server .
thanks ..
Send data to Google SpreadSheet and return back answer from server .
thanks ..
Re: [SOLVED] urequests + redirects
I'll try it.Thanks.
SpotlightKid wrote: ↑Mon Jan 18, 2021 10:59 pmHere, I fixed it for ya:meebox wrote: ↑Tue Dec 01, 2020 11:51 amCan you show me how to use this library in MicroPython? I get error showing me the ussl module doesn't have the SSLContext method.Thanks.mcauser wrote: ↑Fri May 31, 2019 8:42 amIt’s moved here:
https://github.com/pfalcon/micropython- ... /urequests
https://gist.github.com/SpotlightKid/86 ... 41dd269c44
Tested it on an ESP32 with pre-built firmware version esp32-idf3-20210118-unstable-v1.13-274-g49dd9ba1a.bin:
I renamed the module to 'prequests.py', because the current MicroPython firmware for the ESP32 already has an "urequest" module built in, but that does not support redirects and you can't overwrite it with a module file with the same name.
Hth, ChrisCode: Select all
$ mpy-cross prequests.py $ rshell -p /dev/ttyUSB0 cp requests.mpy /pyboard $ rshell -p /dev/ttyUSB0 repl >>> import prequests >>> # note NO trailing slash => triggers a redirect to 'https://chrisarndt.de/impressum/' >>> r = prequests.get('https://chrisarndt.de/impressum') >>> print(r.text[:100])
Re: [SOLVED] urequests + redirects
HI
I installed the library that you mention.
I renamed
and I got an error OSError: -202
I could not test with esp32-idf3-20210118-unstable-v1.13-274-g49dd9ba1a.bin because it's not available,
so I tested with esp32-idf4-20210202-v1.14.bin
May you help me?
I'm trying to get data from a Google Sheet Web API, that already works with postman.
Thanks
I installed the library that you mention.
I renamed
and I got an error OSError: -202
I could not test with esp32-idf3-20210118-unstable-v1.13-274-g49dd9ba1a.bin because it's not available,
so I tested with esp32-idf4-20210202-v1.14.bin
May you help me?
I'm trying to get data from a Google Sheet Web API, that already works with postman.
Thanks
Re: [SOLVED] urequests + redirects
Hi Chris,SpotlightKid wrote: ↑Mon Jan 18, 2021 10:59 pmHere, I fixed it for ya:meebox wrote: ↑Tue Dec 01, 2020 11:51 amCan you show me how to use this library in MicroPython? I get error showing me the ussl module doesn't have the SSLContext method.Thanks.mcauser wrote: ↑Fri May 31, 2019 8:42 amIt’s moved here:
https://github.com/pfalcon/micropython- ... /urequests
https://gist.github.com/SpotlightKid/86 ... 41dd269c44
Tested it on an ESP32 with pre-built firmware version esp32-idf3-20210118-unstable-v1.13-274-g49dd9ba1a.bin:
I renamed the module to 'prequests.py', because the current MicroPython firmware for the ESP32 already has an "urequest" module built in, but that does not support redirects and you can't overwrite it with a module file with the same name.
Hth, ChrisCode: Select all
$ mpy-cross prequests.py $ rshell -p /dev/ttyUSB0 cp requests.mpy /pyboard $ rshell -p /dev/ttyUSB0 repl >>> import prequests >>> # note NO trailing slash => triggers a redirect to 'https://chrisarndt.de/impressum/' >>> r = prequests.get('https://chrisarndt.de/impressum') >>> print(r.text[:100])
I am on windows 10 and I want to copy the requests lib to my esp32 cam board.
I tried using your solution and copy the .mpy file to the board. But, I am not able to use the copy function properly since it seems the files are printed as copied to the same directory as I specify as source instead of the device.