python - 将 curl 请求转换为 python 请求
问题描述
请给我这个 curl 请求的 python 请求示例
curl -X POST "https://api.skinbaron.de/Search" -H "accept: application/json" -H "content-type: application/json" -d "{ \"apikey\": \"string\", \"appid\": 0, \"search_item\": \"string\", \"min\": 0, \"max\": 111, \"after_saleid\": \"string\", \"items_per_page\": 0}"
解决方案
看看uncurl项目。使用 python3,我能够将您的 curl 请求解析为相应的 pythonic 版本:
requests.post("https://api.skinbaron.de/Search",
data='{ apikey: string, appid: 0, search_item: string, min: 0, max: 111, after_saleid: string, items_per_page: 0}',
headers={
"accept": "application/json",
"content-type": "application/json"
},
cookies={},
)