Saving tif file from tricky webserver

Diez B. Roggisch deets at nospam.web.de
Fri May 30 07:09:30 EDT 2008


schweet1 schrieb:
> Greetings,
> 
> I am attempting to automate accessing and saving a file (a TIF) from
> the following URL:
> 
> http://patimg1.uspto.gov/.DImg?Docid=US007376435&PageNum=1&IDKey=E21184B8FAD5
> 
> I have tried some methods using urllib, httplib, and
> web32com.client(InternetExplorer), but haven't been successful.
> Currently I am using (in Python 2.5)
> 
> import webbrowser
> 
> url = [see above]
> 
> webbrowser.open(url, new=0, autoraise=0)
> 
> When this is run a windows popup dialog opens asking me to Open, Save,
> or Cancel.  However, if I query multiple such URLs, I do not want to
> have to respond manually.  Is there a way I can use Python to save the
> TIF?

You need to figure out what really becomes the download url, and use 
that. Use e.g. http live headers for firefox to get that information.

If the server needs the form-submitting stuff to actually grant access 
to the TIFF, you might need to use mechanize to talk to the site as if 
you were a browser.

Diez



More information about the Python-list mailing list