python发http请求

第一步 安装 requests 

pip install requests

 python代码

复制代码
# 导入requests库
import requests

# 目标URL
url = "http://192.168.1.1/get.php?calltel=13941128888888"

# 发送GET请求
response = requests.get(url)

# 检查请求是否成功
if response.status_code == 200:
    print("请求成功!")
    print("响应内容:", response.text)
else:
    print("请求失败,状态码:", response.status_code)
复制代码

 

posted @   海乐学习  阅读(15)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2012-04-10 C++ map的基本操作和使用
点击右上角即可分享
微信分享提示