We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 12b1cec commit 6d2ebc6Copy full SHA for 6d2ebc6
2 files changed
quickchart/__init__.py
@@ -66,7 +66,7 @@ def get_short_url(self):
66
67
def get_bytes(self):
68
resp = self._post('https://quickchart.io/chart')
69
- return response.content
+ return resp.content
70
71
def to_file(self, path):
72
content = self.get_bytes()
tests.py
@@ -33,5 +33,21 @@ def test_no_chart(self):
33
34
self.assertRaises(RuntimeError, qc.get_url)
35
36
+ def test_get_bytes(self):
37
+ qc = QuickChart()
38
+ qc.width = 600
39
+ qc.height = 300
40
+ qc.config = {
41
+ "type": "bar",
42
+ "data": {
43
+ "labels": ["Hello world", "Test"],
44
+ "datasets": [{
45
+ "label": "Foo",
46
+ "data": [1, 2]
47
+ }]
48
+ }
49
50
+ self.assertTrue(len(qc.get_bytes()) > 8000)
51
+
52
if __name__ == '__main__':
53
unittest.main()
0 commit comments