Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Fortune Cookie" API is Old #4

Open
koki0702 opened this issue Oct 7, 2015 · 3 comments
Open

"Fortune Cookie" API is Old #4

koki0702 opened this issue Oct 7, 2015 · 3 comments

Comments

@koki0702
Copy link

koki0702 commented Oct 7, 2015

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>
@alnash28
Copy link

@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?

@alnash28
Copy link

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.

@alnash28
Copy link

I got it! We can fetch the docs for urllib.request from PSF.. here That would be kinda funny 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants