allow passing import list via stdin

This commit is contained in:
Nick Sweeting 2019-01-14 18:11:48 -05:00
parent cb60bad1d7
commit 39f5e12364
2 changed files with 37 additions and 2 deletions

View file

@ -180,6 +180,20 @@ def pretty_path(path):
return path.replace(REPO_DIR + '/', '')
def save_source(raw_text):
if not os.path.exists(SOURCES_DIR):
os.makedirs(SOURCES_DIR)
ts = str(datetime.now().timestamp()).split('.', 1)[0]
source_path = os.path.join(SOURCES_DIR, '{}-{}.txt'.format('stdin', ts))
with open(source_path, 'w', encoding='utf-8') as f:
f.write(raw_text)
return source_path
def download_url(url):
"""download a given url's content into downloads/domain.txt"""