How can we use HTTP request with UIFlow 2.0?
-
Hi,
I'm trying to implement an HTTP client on AtomS3 Lite with UIFlow 2.0. I have implemented on ATOM LITE with UIFlow 1.0 as follows:
My questions are as follows:
- When should we use
HTTP close
, right after anHTTP request
block or after handling a response? - What is equivalent to
Get Data
in UIFlow 1.0,get content
orget text
?
It would be much appreciated if you give me advice regarding this topic.
Thank you very much in advance,
Shigeru - When should we use
-
Hi,
I found that the following code works as I expected. I want to share for your reference until official examples are provided.
Thanks,
Shigeru -
Hi Shigeru,
Can you share how do you install the "urequests" module?
I downloaded from the link below and copied to libs/
https://github.com/m5stack/M5Stack_MicroPython/blob/master/MicroPython_BUILD/components/micropython/esp32/modules/urequests.pybut I got the following error:
Traceback (most recent call last):
File "main.py", line 105, in <module>
File "main.py", line 92, in loop
File "/flash/libs/urequests.py", line 112, in get
File "/flash/libs/urequests.py", line 97, in request
NotImplementedError: Redirects not yet supportedThanks
-
Http close is used at the end to terminate HTTP request sessions.
I'm trying to work on logging and documenting the functions but its slow going.
-
Hi,
I am new, but I have been poking around since I experienced the urequests library not found error.
I REPL'd into my Core3,, and sure enough, it wasn't there, but there was one called requests.
I did some poker with the code in UiFlow and read many Google answers, but I managed to get it to work. I ended up with the HTTP request in a code block.
http_req = requests.request(
method='POST',
url='http://192.168.1.51/json/state',
headers={'Content-Type':'application/json'},
data='{"on":true,"bri":255, "v":true, "seg":{"fx":"r", "pal":"r"}}'
)
http_req.close()It seemed to work for me, but I would prefer to get it working correctly.