Skip to content

Instantly share code, notes, and snippets.

@siennathesane
Created September 9, 2015 00:45
Show Gist options
  • Save siennathesane/dacb5671d1d1702bc5dc to your computer and use it in GitHub Desktop.
Save siennathesane/dacb5671d1d1702bc5dc to your computer and use it in GitHub Desktop.
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