Skip to content

Instantly share code, notes, and snippets.

@sunfkny
Last active September 16, 2023 04:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunfkny/ca17708a4702486e2199c672e844342a to your computer and use it in GitHub Desktop.
Save sunfkny/ca17708a4702486e2199c672e844342a to your computer and use it in GitHub Desktop.
import httpx
client = httpx.Client(http2=True)
url = "https://www.tesla.cn/inventory/api/v1/inventory-results"
headers = {
"Referer": "https://www.tesla.cn/inventory/used/ms?Province=CN&FleetSalesRegions=CN",
"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",
}
params = {
"query": '{"query":{"model":"ms","condition":"used","options":{"FleetSalesRegions":["CN"]},"arrangeby":"Price","order":"asc","market":"CN","language":"zh","super_region":"north america","lng":"","lat":"","zip":"","range":0},"offset":0,"count":50,"outsideOffset":0,"outsideSearch":false}'
}
response = client.get(url, params=params, headers=headers, timeout=2)
print(response.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment