pydo icon indicating copy to clipboard operation
pydo copied to clipboard

invoices.get_csv_by_uuid fails with JSONDecodeError

Open mstyne opened this issue 7 months ago • 4 comments

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 avatar May 12 '25 13:05 mstyne

@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

krish57-bit avatar Oct 07 '25 15:10 krish57-bit

!assign

aniketsingh1023 avatar Oct 07 '25 15:10 aniketsingh1023

Hi i would like to work on this issue . Please assign it to me @mstyne

ProgrammingPirates avatar Oct 08 '25 08:10 ProgrammingPirates

Sorry all, I don't have the power to assign this bug. Someone at DigitalOcean probably has to.

mstyne avatar Oct 08 '25 14:10 mstyne