首页 > 解决方案 > Python API 请求

问题描述

我是 Python API 的新手,我正在尝试从端点检索数据,但我不断收到错误 400 错误请求我做错了什么?

这是我的代码:

import requests 

payload = {
   "header" : {
    "cookie" :""
   },
    "body": {
        "email": "customer@****.com",
        "password": "****"
    }
}

headers = {
        'Host': 'https://ije-api.tcore.xyz',
        'User-Agent': 'PostmanRuntime/7.18.0',
        'Accept': 'application/json',
        'Accept-Language': 'en-US,en;q=0.5',
        'Accept-Encoding': 'gzip, deflate, br',
        'Referer': 'https://ije-api.tcore.xyz', 
        'Content-Type':'application/json',
        'X-Requested-With': 'XMLHttpRequest',
        'Connection': 'keep-alive',

    }

request = requests.post("https://ije-api.tcore.xyz/v1/auth/login", json = payload, headers=headers)
print(request.text)

标签: pythonpython-requests

解决方案


推荐阅读