3304 views|2 replies

129

Posts

1

Resources
The OP
 

[Micropython Tutorial] Network Programming Part 2#Http Client Function# [Copy link]

 

The first article of network programming introduced how to use the usocket module of MicroPython. With the foundation of the previous article, we will now introduce how to use the Http Client function on RT-Thread MicroPython. The main module used in this chapter is urequests. ### Get and install the urequests module There are two ways to get this module. For detailed operations, please refer to the package management chapter: - Method 1: Use the upip package management tool to download. Here, use the upip.install("micropython-urequests") command. The upip tool will automatically download and install the urequests module. The download process is shown in the figure:

- Method 2: Copy from MicroPython-lib to the /libs/mpy directory of the file system on the development board. Next, the urequests module can be imported and used. ### Use of the urequests module The following example program uses the get command to grab the homepage information of http://www.baidu.com/ and format the output: python try: import urequests as requests except ImportError: import requests r = requests.get("http://www.baidu.com/") print(r) print(r.content) print(r.text) r.close()

Original, if you need to reprint or use it for commercial purposes, you must obtain the author’s consent and indicate the source

Latest reply

Mark  Details Published on 2018-5-27 20:05
 
 

128

Posts

0

Resources
2
 
Mark
 
 
 

129

Posts

1

Resources
3
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list