0

How do i make Json requests to an endpoint to show the response in Json rather than show the response

i sent a POST request to a server and i am getting this as response.

D:\python>python runVacc.py
<Response [200]>

Which means its a successful request, but i want it to show both the Success as well as the Json Response. My Code is looking thus :

import requests
import json

url = 'URL HERE'

data = {"email":"[email protected]","is_permanent":True,"bvn":"12345678901","tx_ref":"VAL12","phonenumber":"08098688235","firstname":"John","lastname":"Fish","narration":"Test ACC"}

res = requests.post(url, data=json.dumps(data),headers={'Content-Type':'application/json','Authorization':'Bearer FLWSECK_TEST-2033696a107e162088cdb02f777fa44e-X'})

print(res)

How do I make it to print Json Response containing the Json Data?

Please help, I am new to this.

1 Answer 1

2

Use print(res.content) instead.

Sign up to request clarification or add additional context in comments.

2 Comments

or use print(res.json())
@MartinsM, yes, this was also very lovely too! Thank you. It also worked as expected

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.