Skip to content

Commit 9ad873c

Browse files
author
Sergio Sanchez
committed
Merge branch 'master' of https://github.com/chekos/datawrapper
2 parents 9d204c1 + 6181069 commit 9ad873c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

datawrapper/__main__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ def create_chart(
151151
_header = self._auth_header
152152
_header["content-type"] = "application/json"
153153

154-
_data = {"title": title, "type": chart_type, "folderId": folder_id}
154+
_data = {"title": title, "type": chart_type}
155+
156+
if folder_id:
157+
_data["folderId"] = folder_id
155158

156159
new_chart_response = r.post(
157160
url=self._CHARTS_URL, headers=_header, data=json.dumps(_data)
@@ -174,7 +177,7 @@ def create_chart(
174177
print(f"New chart {chart_info['type']} created!")
175178
else:
176179
print(
177-
"Chart could not be created, check your authorization credentials (access token)"
180+
f"Chart could not be created, check your authorization credentials (access token){', and that the folder_id is valid (i.e exists, and your account has access to it)' if folder_id else ''}"
178181
)
179182

180183
if data is not None:

0 commit comments

Comments
 (0)