Skip to content

Responses are stringified and cannot be parsed #12

@gormster

Description

@gormster

I have no idea why, but for some reason every single API call has response_type set to 'str' instead of object like it should be. There are no ClickSend APIs that return anything other than a JSON object. However, since calling str on a dict actually causes it to be serialised in a way that is not necessarily parseable Python code (like calling repr should) you end up with a result that might be able to passed to, say, eval (though obviously I'd prefer not to do that!) but might not.

To be clear, the code is not returning the raw JSON response. It's parsing the JSON, then calling str on that response, which makes it not valid JSON. It also might not be valid Python. It's just supposed to be a human-readable version of the thing.

Proposed solution

Replace every instance of response_type='str' with response_type=object. As far as I can tell, there are zero instances where the ClickSend API returns an actual string - even if there were, __deserialize_object simply returns the original value unchanged, so any strings will be passed through correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions