Daniel,<div><br></div><div>Thanks for your tips. I was able to add a user agent string like this:</div><div><br></div><div>OLPCReader/1.0; +mailto:<a href="mailto:nicestep">nicestep</a><a>@gmail.com</a></div><div><br></div>
<div>and that fixed the problem. The code has been committed to Git and I'll release a new .xo file shortly.</div><div><br></div><div>I don't know that I'll submit a path for network.py as the user agent string is not a problem for most uses.</div>
<div><br></div><div>James Simmons</div><div><br><br><div class="gmail_quote">On Sun, Feb 10, 2013 at 7:05 PM, Daniel Narvaez <span dir="ltr"><<a href="mailto:dwnarvaez@gmail.com" target="_blank">dwnarvaez@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Actually it seems like you might be able to<span></span> do it with urllib too.<div><br></div><div><span style="font-family:Helvetica;font-size:15px;white-space:nowrap"><a href="http://docs.python.org/2/library/urllib.html" target="_blank">http://docs.python.org/2/library/urllib.html</a></span></div>
<div><font face="Helvetica"><span style="font-size:15px;white-space:nowrap"><br></span></font></div><div><font face="Helvetica"><span style="font-size:15px;white-space:nowrap">Search for urlopener, there is an example.<br>
</span></font><div><div class="h5"><br>On Monday, 11 February 2013, Daniel Narvaez wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><a href="http://git.sugarlabs.org/sugar-toolkit-gtk3/sugar-toolkit-gtk3/blobs/master/src/sugar3/network.py" target="_blank">http://git.sugarlabs.org/sugar-toolkit-gtk3/sugar-toolkit-gtk3/blobs/master/src/sugar3/network.py</a><br>
</div>
<div><br></div>That code *looks* trivial to port to urllib2. You could do that, submit the patch and in the meantime just copy and paste the ported code in your activity (it doesn't seem to have dependencies on other toolkit stuff). Well, unless it's a gtk2 activity, in that case you can skip the "submit the patch" step<span></span> :)<br>
<br>On Monday, 11 February 2013, James Simmons wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Marcello (and everyone else who replied):<div><br></div><div>
It looks like the mirrors have the same policy. I'm currently using this to download from the URL:</div><div><br></div><div><a href="http://doc.sugarlabs.org/epydocs/sugar.network.GlibURLDownloader-class.html" target="_blank">http://doc.sugarlabs.org/epydocs/sugar.network.GlibURLDownloader-class.html</a></div>
<div><br></div><div>I'm not seeing a way to put a user agent in using this code. It looks like urllib2 supports it. I used the other because I was already using it for collaboration and it gives me a way to do a progress report on the download. I appreciate everyone's detective work and suggestions.</div>
<div><br></div><div>James Simmons</div><div><br><br><div class="gmail_quote">On Sun, Feb 10, 2013 at 1:22 PM, Marcello Perathoner <span dir="ltr"><<a>marcello@perathoner.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On 02/10/2013 06:46 PM, James Simmons wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I had created an Activity for the One Laptop Per Child project which<br>
downloads and reads the Plain Text version of PG titles. I use the offline<br>
catalogue and some Python code to list available titles in the catalogue<br>
that match a search string. For instance the child might enter "Twain" and<br>
get a list of all the books by and about Twain. Then the child can<br>
download the book using the same program.<br>
<br>
This has been working well for years but lately it has stopped working.<br>
When I try to debug it I see it trying to download this URL for instance:<br>
<br>
<a href="http://www.gutenberg.org/dirs/1/1/119/119.zip" target="_blank">http://www.gutenberg.org/dirs/<u></u>1/1/119/119.zip</a><br>
</blockquote>
<br>
<br></div>
Supply a user-agent that clearly defines your app and provides a way to contact you eg.<br>
<br>
OLPCReader/1.0; +<a href="http://www.olpc-reader.org/app-info.html" target="_blank">http://www.olpc-reader.org/<u></u>app-info.html</a><br>
<br>
OLPCReader/1.0; +mailto:<a>me@example.com</a><br>
<br>
The standard Python-urllib user agent will not do!<br>
<br>
<br>
or<br>
<br>
<br>
use a mirror site. See: <a href="http://www.gutenberg.org/MIRRORS.ALL" target="_blank">www.gutenberg.org/MIRRORS.ALL</a><br>
<br>
<br>
<br>
<br>
<br>
Regards<span><font color="#888888"><br>
<br>
-- <br>
Marcello Perathoner<br>
<a>webmaster@gutenberg.org</a><br>
</font></span></blockquote></div><br></div>
</blockquote><br><br>-- <br>Daniel Narvaez<br><br>
</blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br>-- <br>Daniel Narvaez<br><br>
</font></span></blockquote></div><br></div>