Skip to content

Commit

Permalink
Merge pull request #374 from palewire/get-data
Browse files Browse the repository at this point in the history
  • Loading branch information
chekos authored Sep 24, 2023
2 parents 910d74d + a2b8a5e commit 30782e6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions datawrapper/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,31 @@ def chart_properties(
)
return None

def chart_data(self, chart_id: str):
"""Retrieve the data stored for a specific chart, table or map, which is typically CSV.
Parameters
----------
chart_id : str
ID of chart, table, or map.
Returns
-------
dict
A dictionary containing the information of the chart, table, or map.
"""
# Request the data endpoint
response = r.get(
url=self._CHARTS_URL + f"/{chart_id}/data",
headers=self._auth_header,
)

# Check if the request was successful
assert response.ok, "Make sure you have the right id and authorization credentials (access_token)."

# Return the data
return response.json()

def update_metadata(
self, chart_id: str, properties: Dict[Any, Any]
) -> Union[Any, None]:
Expand Down

0 comments on commit 30782e6

Please sign in to comment.