一个http请求包括三个部分,为别为请求行,请求报头,消息主体,类似以下这样: 请求行,请求报头,消息主题。
以json串提交数据,编码格式: application/json, 必须加上
import requests import json headers = { "Content-Type": "application/json; charset=UTF-8" } url = "http://jinbao.pinduoduo.com/network/api/common/goodsList" pyload = {"keyword": "", "sortType": 0, "withCoupon": 0, "categoryId": 16, "pageNumber": 1, "pageSize": 60} response = requests.post(url, data=json.dumps(pyload), headers=headers).text print(response)