downloading an excel file from the web in python

Solution 1:

I suggest using requests:

import requests
dls = "http://www.muellerindustries.com/uploads/pdf/UW SPD0114.xls"
resp = requests.get(dls)

output = open('test.xls', 'wb')
output.write(resp.content)
output.close()

To get requests installed:

pip install requests

Solution 2:

To add on to Fedalto's requests suggestion (+1), but make it more Pythonic with a context manager:

import requests
dls = "http://www.muellerindustries.com/uploads/pdf/UW SPD0114.xls"
resp = requests.get(dls)
with open('test.xls', 'wb') as output:
    output.write(resp.content)