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

How to use APIs with Python Forum

View Course » View Exercise

881 points
512e4a66df15da5842001ec2_653659021
Submitted by
jacob grant
over 4 years ago

6/20 [resolved] How to make a GET request?

import requests

Make a GET request here and assign the result to kittens:

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

print kittens.text[559:1000]


6 votes

permalink

You need to set the variable kittens to the result of requests.get("http://placekitten.com/") not to the web address. Your finished code should look like this kittens = requests.get("http://placekitten.com/")

808 points
50d72c5292f2af5c6c0058d1_96933639
Submitted by
Z
over 4 years ago

2 Comments

512e4a66df15da5842001ec2_653659021 jacob grant over 4 years ago

thank you so much...it works now

71c15ab76387ac5ba6529a80914cede8?s=140&d=retro Ruben van Houten about 2 years ago

Thanks, that helped.


0 votes

permalink

import requests
kittens = requests.get('http://placekitten.com/')
print kittens.text[559:1000]

2835 points
5221a0a780ff33cbb900052b_894281508
Submitted by
Ⓩⓐⓘⓓⓗⓐⓐⓝ
over 3 years ago