Responses: Content and Headers
When dealing with
requests we are mostly interested in the content we receive. In this lesson you’ll learn how to access the response content as well as the response meta information stored in the headers.
You can access the content of a response in three different ways and formats. Here is a quick overview about the different ways and formats:
content: This attribute returns the raw bytes of the response content
textattribute returns the content as a normal UTF-8 encoded Python string
json(): You can use the
json()method to get the response content in JSON format
headers attributes returns a Python dictionary with all of the response headers.
Comments & Discussion
Become a Member to join the conversation.