Skip to content

Instantly share code, notes, and snippets.

@bbengfort
Created August 8, 2013 20:12
Show Gist options
  • Save bbengfort/6188250 to your computer and use it in GitHub Desktop.
Save bbengfort/6188250 to your computer and use it in GitHub Desktop.
For grant
#!/usr/bin/env python
import os
import sys
import time
ACCESS_KEY = ''
SECRET_KEY = ''
def get_name_for_file(url):
name = raw_input("What should we name %s? " % url)
return name
def send_to_s3():
pass
def handle_url(url):
print url
name = get_name_for_file(url)
#pretend we're downloading
time.sleep(2)
print name
# do s3 thing
send_to_s3()
def handle_line(line):
# This is the clean up URLS and fix & sign thingy.
line = line.strip()
if line and line.startswith('http'):
handle_url(line)
def readlines(path):
with open(path, 'r') as urls:
for idx, line in enumerate(urls):
handle_line(line)
if __name__ == "__main__":
# readlines("urls.txt")
path = os.path.abspath("urls.txt")
print path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment