Home > Software design >  Show Json Data from Python
Show Json Data from Python

Time:10-29

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.

CodePudding user response:

Use print(res.content) instead.

  • Related