Created
September 9, 2015 00:45
-
-
Save siennathesane/dacb5671d1d1702bc5dc to your computer and use it in GitHub Desktop.
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
urls = { "filename": "http://url" } | |
ftp_urls = { "filename": "ftp://url" } | |
def pull_files(): | |
for file in ftp_urls: | |
urllib.urlretrieve(file) | |
for key, value in urls.items(): | |
with open(key, 'wb') as handle: | |
response = requests.get(value, stream=True) | |
if not response.ok: | |
sys.exit(1) | |
for block in response.iter_content(1024): | |
handle.write(block) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment