I need to upload multiple files via http in Python.
The most obvious way to do this is to simply use urllib2:
import urllib2 u = urllib2.urlopen('http://server.com/file.html') localFile = open('file.html', 'w') localFile.write(u.read()) localFile.close()
But I have to deal with URLs that are disgusting, for example: http://server.com/!Run.aspx/someoddtext/somemore?id=121&m=pdf . When downloading via a browser, the file has a user-friendly name, that is. accounts.pdf .
Is there a way to handle this in python, so I don't need to know the file names and hardcode them into my script?
kender May 14 '09 at 8:21 a.m. 2009-05-14 08:21
source share