Skip to content

Commit 21376e8

Browse files
committed
Merge branch 'master' of github.com:typpo/quickchart-python
2 parents 8096fe6 + 0ee55c4 commit 21376e8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A Python client for the [quickchart.io](https://quickchart.io/) image charts web
77

88
# Installation
99

10-
Use the `quickchart.py` library in this project, or install through [pip](https://pypi.org/project/quickchart.io/):
10+
Use the `quickchart` library in this project, or install through [pip](https://pypi.org/project/quickchart.io/):
1111

1212
```
1313
pip install quickchart.io

quickchart/__init__.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,20 @@ def _post(self, url):
9696
}
9797
resp = requests.post(url, json=postdata, headers=headers)
9898
if resp.status_code != 200:
99+
err_description = resp.headers.get('x-quickchart-error')
99100
raise RuntimeError(
100-
'Invalid response code from chart creation endpoint')
101+
'Invalid response code from chart creation endpoint: %d%s'
102+
% (resp.status_code, '\n%s' % err_description if err_description else '')
103+
)
101104
return resp
102105

106+
103107
def get_short_url(self):
104108
resp = self._post('%s/chart/create' % self.get_url_base())
105109
parsed = json.loads(resp.text)
106110
if not parsed['success']:
107111
raise RuntimeError(
108-
'Failure response status from chart creation endpoint')
112+
'Chart creation endpoint failed to create chart')
109113
return parsed['url']
110114

111115
def get_bytes(self):

0 commit comments

Comments
 (0)