Fiddler撰写的请求在python请求中不起作用

时间:2019-08-31 20:07:42

标签: python python-requests fiddler getmethod

我正在尝试使用python中的requests.get()发送get请求。在提琴手作曲家中请求成功(response: 200)时。我在Python中得到response: 403

这是提琴手作曲家中的代码:

GET https://usertitles.xboxlive.com/users/gt(gamertag)/titles HTTP/1.1

x-xbl-contract-version: 1
Accept: application/json
Authorization: XBL3.0 x=147820683349...
Host: usertitles.xboxlive.com
Connection: Keep-Alive

这是python中的样子:

import requests


def check():
    url = 'https://usertitles.xboxlive.com/users/gt(gamertag)/titles'
    headers = {
        'x-xbl-contract-version': '1',
        'Accept': 'application/json',
        'Authorization': 'XBL3.0 x=147820683349...'
        'Host': 'usertitles.xboxlive.com',
        'Connection': 'Keep-Alive',
    }
    res = requests.get(url, headers=headers)
    print(res.status_code)


check()

任何想法,为什么它不起作用?

0 个答案:

没有答案