#π Requesting data from html api via python.
12 messages Β· Page 1 of 1 (latest)
@leaden musk
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
you probably want the requests package
Played around for a bit with requests but cant find out how to get any data point. Here is my code:
import requests
response = requests.get("https://smartytitans.com/historical-data")
print(response.json())
what does it do?
I tried ```py
In [4]: requests.get("https://smartytitans.com/api/arbitrage/all").json()
Out[4]:
{'data': [{'id': 436768,
'offerId': 1556397737,
'requestId': 1556389193,
'tType': 'o',
this worked, but it took a few seconds ```py
In [7]: requests.post("https://smartytitans.com/api/historical/single", json={ "tType": "string",
...: "uid": "string",
...: "tag1": "string",
...: "rangeDates": [
...: "2024-12-01T20:05:30.123Z"
...: ]}).content
Out[7]: b'{"data":[],"count":0}'
Thank you. Needed to know where to put the request body. Saved me some time.
yeah, unfortunately that API page only shows examples for curl, and not requests. You just gotta know π
Ill leave the thread open for a few more minutes if more problems come up :)
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.