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

How to use APIs with Python Forum

View Course

803 points
Submitted by
Svitri Magnusson
about 3 years ago

Difference between response.status_code & print response

import requests
response = requests.get('')
# Add your code below!

print response.status_code works also, but I could not pass using just print reponse. Why?

0 votes


I set it to a variable to print it. Just like how the request.get() method is set to the
variable 'response'.

status = response.status_code
print status

I'm assuming 'response.status_code' by itself will only return a value, but not print it.

747 points
Submitted by
CJ Bradbury
about 3 years ago

0 votes


Response variable stores everything from the requests.get().
By calling response.status_code it will only return that 3 digit status code.

401 points
Submitted by
almost 3 years ago