siesta icon indicating copy to clipboard operation
siesta copied to clipboard

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

Open tarunchhabra26 opened this issue 9 years ago • 2 comments

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.

tarunchhabra26 avatar Feb 18 '16 04:02 tarunchhabra26

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)

bradallred avatar Dec 30 '16 20:12 bradallred

Hello,

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

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

armSeb avatar Sep 01 '17 10:09 armSeb