This forum is now read-only. Please use our new forums at discuss.codecademy.com.

How to use APIs with Python Forum

View Course

1834 points
54c68b3a9113cb1e5200035f_114210188
Submitted by
Ojas Rajwansh
over 2 years ago

12/20 [resolved] plz healp

import requests
response = requests.get("http://placekitten.com/")

print the header information from the response

print = response.requests


0 votes

permalink

Hi Ojas,

Here is the error I see when I try your code:

Traceback (most recent call last):
  File "python", line 13, in <module>
AttributeError: 'Response' object has no attribute 'requests'

That is telling you that you can't use 'requests` as you have. This part of the error message is trying to point you in the right direction:

Oops, try again. You should call response.headers to get the header data attribute.

It means that you should use this code to print the headers:

print response.headers

3691 points
55df2afa95e3787b9200005e_359368177
Submitted by
Judy
over 2 years ago

2 Comments

54c68b3a9113cb1e5200035f_114210188 Ojas Rajwansh over 2 years ago

yoo thanks that worked

55df2afa95e3787b9200005e_359368177 Judy over 2 years ago

You're welcome.