Python request.post不适用于有效负载和标头。需要帮助

时间:2019-06-18 18:29:34

标签: python post python-requests postman

由于我已经在邮递员应用程序上进行了测试,因此我尝试使以下代码在python中工作,并且效果很好。我想念什么吗? 状态为403

import requests
import json

headers = {'Content-Type': 'application/json'}
payload = {"query":"query ShmeCreateTeamQuery( $site: String! $tourId: Int! $teamId: Int = -1 $matchId: Int!) { site(slug: $site) { name showTeamCombination { count siteKey } teamPreviewArtwork { src } teamCriteria { totalCredits maxPlayerPerSquad totalPlayerCount } roles { id artwork { src } color name pointMultiplier shortName } playerTypes { id name minPerTeam maxPerTeam shortName artwork { src } } tour(id: $tourId) { match(id: $matchId) { id guru squads { flag { src } flagWithName { src } id jerseyColor name shortName } startTime status players(teamId: $teamId) { artwork { src } squad { id name jerseyColor shortName } credits id name points type { id maxPerTeam minPerTeam name shortName } lineupStatus { status text color } isSelected role { id artwork { src } color name pointMultiplier shortName } } tour { id } } } } me { isGuestUser showOnboarding }}","variables":{"tourId":"1064","matchId":"14758","site":"cricket"}}

res = requests.post(url='https://www.dream11.com/graphql/query/pwa/shme-create-team-query', data=payload,headers = headers )
res.status_code

这是邮递员工作的短片

enter image description here

0 个答案:

没有答案