Question on using urllib
Olivier Scalbert
olivier.scalbert at algosyn.com
Thu Nov 11 11:58:28 EST 2010
Hello all,
Sorry if this question is not 100% python related, it is also related to
http or html ...
Everything takes place in this page:
http://www.infometeo.be/klanten/KYC/campage2mega.php
With the following program, I can download the 2 small meteo images,
without any problem:
import urllib
urllib.urlretrieve("http://www.infometeo.be/wwweather/currentimage.php?icao=EBFN",
"meteo1.jpg")
urllib.urlretrieve("http://www.meteokust.be/metstatgr.php?s=zb",
"meteo2.jpg")
But I would like to download the main background picture.
By looking inside the html page, it seems it's url is:
http://www.infometeo.be/img.php?iid=1057
...
<table bgcolor="#6699FF">
<tr>
<td>
<table width="1280" height="960"
background="http://www.infometeo.be/img.php?iid=1057">
<tr>
<td align="right" valign="bottom">
...
Warning, the iid may vary depending time ...
I try to download it with python:
urllib.urlretrieve("http://www.infometeo.be/img.php?iid=1057",
"picture.jpg")
But then I receive only 2 bytes: CR LF I think.
If I use this url with my browser (firefox), I also get nothing (a blank
page).
If I go back to the main page with the firebug plugin activated, I can
change the iid directly inside the html code with firebug, and then,
even previous pictures can be displayed ...
So I am a bit lost ... Any help would be very appreciate !!
Thanks,
Olivier
More information about the Python-list
mailing list