pydo
pydo copied to clipboard
invoices.get_csv_by_uuid fails with JSONDecodeError
Hello DigitalOcean,
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
[<ipython-input-11-e27285619f75>](https://localhost:8080/#) in <cell line: 0>()
24 print(latest_uuid)
25
---> 26 invoice_resp = client.invoices.get_csv_by_uuid(latest_uuid)
27 invoice_resp
5 frames
[/usr/lib/python3.11/json/decoder.py](https://localhost:8080/#) in raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I suspect this call fails because the API command returns a string and not JSON.
get_by_uuid for the same invoice UUID has no issues, likely because the response is JSON.
Thanks for your consideration of this issue.
Mike
@mstyne Kindly assign this task to me for Hacktoberfest! I can do the following tasks:
- reproduce and add tests,
- update the SDK method to respect Content-Type (return raw string/bytes for text/csv or text/plain)
- add a helper to parse CSV if desired
!assign
Hi i would like to work on this issue . Please assign it to me @mstyne
Sorry all, I don't have the power to assign this bug. Someone at DigitalOcean probably has to.