首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Python使用request调用htt

Python使用request调用htt

作者头像
py3study
发布于 2020-01-03 11:29:25
发布于 2020-01-03 11:29:25
1K0
举报
文章被收录于专栏:python3python3

1. 安装requests

        pip install requests 

2. 代码:

代码语言:javascript
复制
import requests
url = "http://www.lance.cn/myweb/request"
headers = {'content-type': 'application/json'}
requestData = {"name": "lance", "age": "28"}
ret = requests.post(url, json=requestData, headers=headers)
if ret.status_code == 200:
    text = json.loads(ret.text)
    print(text)
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/09/26 ,如有侵权请联系 cloudcommunity@tencent.com 删除
目录
  • 1. 安装requests
  • 2. 代码:
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档