aosabook/500lines

An url in “Web-server.markdown” is not found

Graceliying82 opened this issue · 4 comments

In Web-server.markdown, there is a piece of code as below:

import requests
response = requests.get('http://aosabook.org/en/500lines/web-server/testpage.html')
print 'status code:', response.status_code
print 'content length:', response.headers['content-length']
print response.text

An URL "http://aosabook.org/en/500lines/web-server/testpage.html" is not found.
image

Thanks for finding this! We still haven't published this chapter yet, though, so there isn't anything to find at that address at the moment. We'll make sure it makes it there during this chapter's release.

I'm going to leave this open until we release the chapter and confirm that it's working then.

Thank you, Michael! I was thrilled by your prompt reply! May I give a small suggestion here.

When I read the next part, I saw the server.py code which returns a fixed page. I was thinking if we let the users put this url "http://localhost:8080" into the previous piece of code. When they run both programs together, they would get exactly what they wrote just now. It might be more fun for them to find out they could be server and client at the same time. And there is another benefit here. No matter when and where the user try this document, they would get a successful result. (Because we can not guarantee the page we offered them is 100% available or they can access it from anywhere. ) For me, I can figure out it's the page-not-found issue. But for some beginners, it may make them feel very frustrated if they can not get a positive result following the document.

:-)

Huh. That's a good suggestion! I'll test it out locally and add it to the chapter if it seems like there aren't any snags.

Hi @Graceliying82, I tried out a couple iterations of your second suggestion, and another technical reviewer suggested that opening two terminals and managing these processes + static file paths properly might be more difficult to figure out than just running this single example. We're going to leave it as-is, but I've uploaded the test page now and it should be working.