以下是一個示例代碼:
import requests url = 'https://api.ipify.org' # 第三方API response = requests.get(url) ip_address = response.text print(ip_address)
這個代碼使用了ipify.org提供的API來獲取IP地址。requests庫用于發(fā)送HTTP請求并獲取響應。獲取到的響應是一個字符串,其中包含了當前計算機的外網(wǎng)IP地址。文章源自網(wǎng)吧系統(tǒng)維護-http://hvig.cn/10576.html 文章源自網(wǎng)吧系統(tǒng)維護-http://hvig.cn/10576.html
版權聲明:文章圖片資源來源于網(wǎng)絡,如有侵權,請留言刪除!!!


評論