File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ A Python client for the [quickchart.io](https://quickchart.io/) image charts web
7
7
8
8
# Installation
9
9
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/ ) :
11
11
12
12
```
13
13
pip install quickchart.io
Original file line number Diff line number Diff line change @@ -96,16 +96,20 @@ def _post(self, url):
96
96
}
97
97
resp = requests .post (url , json = postdata , headers = headers )
98
98
if resp .status_code != 200 :
99
+ err_description = resp .headers .get ('x-quickchart-error' )
99
100
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
+ )
101
104
return resp
102
105
106
+
103
107
def get_short_url (self ):
104
108
resp = self ._post ('%s/chart/create' % self .get_url_base ())
105
109
parsed = json .loads (resp .text )
106
110
if not parsed ['success' ]:
107
111
raise RuntimeError (
108
- 'Failure response status from chart creation endpoint ' )
112
+ 'Chart creation endpoint failed to create chart ' )
109
113
return parsed ['url' ]
110
114
111
115
def get_bytes (self ):
You can’t perform that action at this time.
0 commit comments