Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (1)

Answers (1)

micahw51004915 07-12-2017

How to use APIs with Python:

from urllib2 import Request, urlopen, URLError

request = Request('http://placekitten.com/')

try:

    response = urlopen(request)

    kittens = response.read()

    print kittens[559:1000]

except URLError, e:

    print 'No kittez. Got an error code:', e