Network
Overview
The network module is used by developers to understand the current network status in real time.
net.connected()
- Description: This attribute indicates the current real-time connection status of the device network.
- Value Range: True (the device network is connected) or False (the device network is not connected).
net.config()
- Description: This attribute represents the real-time network information of the current device.
- Return Value
IP
: device IP addressroute
: the routing address corresponding to the device networkdns
: DNS addressrssi
: the signal corresponding to the network the device is connected toessid
: the network name the device is connected to
Usage examples
import net
# Get network connection status
connected = net.connected()
# Get network information
net_info = net.config()
Precautions
- If you want to perform HTTP requests, you can use the urequests module provided in micropython.