gateio / gateapi-python

243 stars 91 forks source link

Returning JSON #116

Closed ghost closed 2 years ago

ghost commented 2 years ago

Is there any way to make the client return JSON objects instead of Ticker for the client.list_tickers() method?

Running json.dumps(x) throws: TypeError: Object of type Ticker is not JSON serializable!

revilwang commented 2 years ago

Yes, you can pass _preload_content=False when you call any API method like list_tickers() to avoid JSON response deserialization.

ghost commented 2 years ago

I wish this was mentioned in the documentation, nevertheless thank you!

revilwang commented 2 years ago

Actually the method python doc tells you that

ghost commented 2 years ago

I didn't notice! Probably because the naming is not intuitive and my IDE lists parameters with preceding _ at the end (maybe because of a coding convention in Python!)

revilwang commented 2 years ago

Problem solved no matter what. Issue closed.

ghost commented 2 years ago

Yes, thank you! On a side note: A comprehensive documentation would be very much appreciated and saved so much time preventing issues being created.