python提交post请求payload webkit_python爬虫,接口是post请求,参数是request payload 的形式,如何传参...

python爬虫,接口是post请求,参数是request payload 的形式,如何传参

解决post payload美团问题,

特别注意json转化

# encoding: utf-8

#url解析

import json

import requests

headers = {

'Content-Type': 'application/json'

}

data = {

"checkInDate": "2020-04-17",

"checkOutDate": "2020-04-18",

"cityId": "184",

"clientType": "touch",

"clientVersion": "999.9",

"goodsId": 633543819,

"goodsType": 1,

"gpsCityId": "184",

"lat": "34.240458",

"lng": "118.853467",

"noPersistent": 0,

"partnerId": 261471,

"requestType": 0,

"poiId": "42367975",

"roomId": 923963218,

"userid": -1

# "propagateData": {"hap_key":0,"price":"D+GukTqN8RF+H6Tf9AY6rw==","traceId":"6706722068678919169","goodsStatus":0,"realGoodsStatus":"4ppBvaihWoVn/5v4JOOPYwY0v8sZt6PPZtnfy6a4Tgw=","conId":0,"gs":"7RyF2M/q4PA6SSMeFT7l3g==","contentTransparent":0}

}

# 传json格式的参数

jdata = json.dumps(data)

url = 'https://ihotel.meituan.com/group/v1/yf/productDetail?_token=eJyrVi/yTFG3UlBX11FQLykGsgxNLcwNDUyNTU2MjC2AgslIomZw0aSiMBegcHQsmB0EZ3rCWLkhMFY2nJUIZ5XAWcWZ6Xkg+1O9yl0cwcDVVr0WAJL6JMU=&uuid=&iuuid=BDBBEFF82F963357D26CA0E58C3BD6C512868DFF22FAFFCEE9820F513311A6C8&userid=&utm_medium=touch&version_name=999.9&platformid=1'

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

print(response.json())

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值