Skip to content

Empty Response but Status Code is 200 #5

@taylorjdawson

Description

@taylorjdawson

I was testing out the get_token_balance.py example. I found that there is a case where the response is empty but the status code is 200; An exception is thrown:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The issue is in client.py:

        if req.status_code == 200:
            return json.loads(req.text)

In this case req.text is empty so executing json.loads() on an empty string throws the aforementioned exception.
There should be a check for an empty response. I have implemented a fix but I wanted to check with you before initiating a pull request.


P.S. This is a fantastic project that I would love contributing to!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions