scastillo / siesta

Sit back, relax and enjoy your REST client for python
scastillo.github.com/siesta
98 stars 19 forks source link

How may I print the response object as a normal string ? #10

Open tarunchhabra26 opened 8 years ago

tarunchhabra26 commented 8 years ago

With normal print statement I just get this as response : (<siesta.Resource object at 0x102051dd0>, <httplib.HTTPResponse instance at 0x10205b5a8>)

I wish to print as a string. Sorry, I am new to python.

bradallred commented 7 years ago

you are getting a Python tuple containing a siesta.Resource along with the "raw" HTTPResponse.

you want something like: api_resource, http_response = api.users.get() then print(http_response.read())

not sure if siesta provides overrides for printing its resources. if it does you could also try print(api_resource)

armSeb commented 7 years ago

Hello,

If your response is in json format, you can easily get it:

ret, resp = api.users.get() print(ret.attrs)