#πŸ”’ Requesting data from html api via python.

12 messages Β· Page 1 of 1 (latest)

leaden musk
rich questBOT
#

@leaden musk

Python help channel opened

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.

hot timber
#

you probably want the requests package

leaden musk
#

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())

hot timber
#

what does it do?

#

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}'

leaden musk
#

Thank you. Needed to know where to put the request body. Saved me some time.

hot timber
#

yeah, unfortunately that API page only shows examples for curl, and not requests. You just gotta know πŸ™‚

leaden musk
#

Ill leave the thread open for a few more minutes if more problems come up :)

rich questBOT
#
Python help channel closed

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.