"Fortune Cookie" API is Old
koki0702 opened this issue · 3 comments
In the book at p.220, "Fortune Cookie" API doesn't work.
Please check!
http://www.iheartquotes.com/api/v1/random
>>> import urllib.request as ur
>>> url = 'http://www.iheartquotes.com/api/v1/random'
>>> conn = ur.urlopen(url)
>>> print(conn)
<http.client.HTTPResponse object at 0x1006fad50>
@koki0702 Look like the service is down. Did you receive the error below?
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
@madscheme This resource may have been moved or take offline for now.Do you have any recommendations?
Here is an updated example. Considering Ch.9(p220), is a web example using urllib from the Standard Library. Why dont we just changed the url request to something else.
import urlib.request as ur
url = 'http://placekitten.com/'
conn = ur.urlopen(url)
print(conn)
<http.client.HTTPResponse object at 0x105b3f4a8>
My URL was borrowed from the CodeAcademy example here. But @madscheme might want to pick something more permanent.