Skip to content

Instantly share code, notes, and snippets.

@AlexJoz
Created November 18, 2016 14:22
Show Gist options
  • Save AlexJoz/3c5b2e7b68b57d7fc2823ea4e7345773 to your computer and use it in GitHub Desktop.
Save AlexJoz/3c5b2e7b68b57d7fc2823ea4e7345773 to your computer and use it in GitHub Desktop.
Download file from http link with python2
import urllib2
#put your link here =)
url = "http://ichart.finance.yahoo.com/table.csv?s=^GSPC&c=2016"
file_name = "table.csv" #can parse fname from url, ofcoz.
u = urllib2.urlopen(url)
gspc = u.read()
with open(file_name, 'wb') as f:
f.write(gspc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment