Python JSON response.json() Python requests














































Python JSON response.json() Python requests



response.json()  Python requests

response.json() returns a JSON object of the result (if the result was written in JSON format, if not it raises an error). Python requests are generally used to fetch the content from a particular resource URI. Whenever we make a request to a specified URI through Python, it returns a response object. Now, this response object would be used to access certain features such as content, headers, etc. This article revolves around how to check the response.json() out of a response object. It is one of the most used methods in requests module.

# import requests module 
import requests 

# Making a get request 
response = requests.get('https://api.github.com') 

# print response 
print(response) 

# print json content 
print(response.json()) 

output:



Comments