最近的开发工作用到了post请求第三方的接口,代码如下

#!/usr/bin/python
# coding:utf8

import requests

url = "http://www.baidu.com"
headers = {"Content-type": "application/json;charset=utf-8"}

post_data = {"username": "spring"}

response = requests.post(url, headers=headers, data=post_data)

print(response)
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐