python-requests Getting started with python-requests Reading the response


Example

response = requests.get("https://api.github.com/events")
text_resp = response.text

JSON response: for json-formatted responses the package provides a built-in decoder

response = requests.get('https://api.github.com/events')
json_resp = response.json()

This method will raise a ValueError in case of empty response or unparseable content.