1
fanhaipeng0403 OP >>> headers
{'sec-ch-ua': '"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"', 'Referer': 'https://www.tesla.cn/inventory/used/ms?Province=CN&FleetSalesRegions=CN', 'sec-ch-ua-mobile': '?0', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36', 'sec-ch-ua-platform': '"macOS"'} >>> url='https://www.tesla.cn/inventory/api/v1/inventory-results? query=%7B%22query%22%3A%7B%22model%22%3A%22ms%22%2C%22condition%22%3A%22used%22%2C%22options%22%3A%7B%22FleetSalesRegions%22%3A%5B%22CN%22%5D%7D%2C%22arrangeby%22%3A%22Price%22%2C%22order%22%3A%22asc%22%2C%22market%22%3A%22CN%22%2C%22language%22%3A%22zh%22%2C%22super_region%22%3A%22north%20america%22%2C%22lng%22%3A%22%22%2C%22lat%22%3A%22%22%2C%22zip%22%3A%22%22%2C%22range%22%3A0%7D%2C%22offset%22%3A0%2C%22count%22%3A50%2C%22outsideOffset%22%3A0%2C%22outsideSearch%22%3Afalse%7D' >>> response = requests.get(url, headers=headers) 一直超时 |
2
sunfkny 2023-09-16 09:58:07 +08:00 3
服务器只支持 HTTP2.0, 建议直接用 httpx 代替 requests,用法基本兼容
pip install httpx[http2] https://gist.github.com/sunfkny/ca17708a4702486e2199c672e844342a |
3
22F41628gA98q4Lx 2023-09-16 11:31:55 +08:00
|
4
fanhaipeng0403 OP @sunfkny 牛逼,感谢,祝你天天开心
|
5
sofarsofunny1 2023-09-16 22:03:12 +08:00
@fanhaipeng0403 你要买二手特斯拉吗
|
6
deorth 2023-09-16 23:06:21 +08:00 via Android
还有人故意不开 http1.1 兼容的,长见识了。马一龙就是牛逼
|
7
Cola98 2023-09-17 12:02:01 +08:00
你可以试下 postman ,可以把 curl 转换成 python 还有一些其他语言
|