Micropython学习交流群 学习QQ群:786510434 提供多种固件下载和学习交流。
Micropython-扇贝物联 QQ群:31324057 扇贝物联是一个让你与智能设备沟通更方便的物联网云平台
Micropython学习交流群 学习QQ群:468985481 学习交流ESP8266、ESP32、ESP8285、wifi模块开发交流、物联网。
Micropython老哥俩的IT农场分享QQ群:929132891 为喜欢科创制作的小白们分享一些自制的计算机软硬件免费公益课程,由两位多年从事IT研发的中年大叔发起。
支持大多数标准 HTTP 请求以及发送和接收分块数据
uHTTP uHTTP是一个Micropython http request module。该模块支持大多数标准 HTTP 请求以及发送和接收分块数据等功能。 安装 将 uhttp 放在运行 Micropython 的微控制器上,并将其与 main.py 或 Micropython PATH 上的其他库目录放在一起。该模块现在应该可供导入。 用法 from uhttp import requests url = 'http://someurl.com/' # GET request r = requests.get(url) print(r.status_code) print(r.text) print(r.json) # GET request which will save the body of the response to data.json r = requests.get(url , save_to_file='data.json') # POST request that sends the file 'data.json' r = requests.post(url , file='data.json') # POST request that sends the file 'my-image.png' r = requests.post(url , file='my-image.png') # POST request that will send data:dict as application/x-www-form-urlencoded r = requests.post(url , data={'data':'my_data'}) # POST request that will send data:dict as application/json r = requests.post(url , json={'data':'my_data'}) # POST request that will send empty body r = requests.post(url) # POST request with custom_headers r = requests.post(url, custom_headers={"Authorization" : "Bearer myToken12355"}) # POST request that will send file in chunks r = requests.post(url, file='my-image.png', chunked=True, chunk_size=128) # Looking through the test directory will provide further insight into how the module functions.
库地址:https://github.com/ksuaning-au/micropython-http
Copyright © 2014 ESP56.com All Rights Reserved
执行时间: 0.0079030990600586 seconds