Created
July 24, 2012 20:11
-
-
Save cesandoval/3172317 to your computer and use it in GitHub Desktop.
Download web files. Takes a url and writes the file into the specified folder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
import urllib2 #urllib is in python 2.7 and later standard libraries | |
except: | |
print('You need to install the URLLIB2') | |
#Download web files. Takes a url and writes the file into the specified folder. | |
url = 'http://www.blog.pythonlibrary.org/wp-content/uploads/2012/06/wxDbViewer.zip' #URL to download data from | |
def Json_Query(url): | |
print('downloading with urllib2') | |
File = urllib2.urlopen(url) #Open the Webpage | |
data = File.read() #Read data from webpage. | |
with open("Json_File.zip", "wb") as Json_file: #Write data into the selected folder. | |
Json_file.write(data) | |
print(data) #You can also print the data on the command line. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment