combine.py and fetch.py can now be imported and used as modules.
This commit is contained in:
Родитель
a120e9dc71
Коммит
4f745efb6f
|
@ -7,7 +7,7 @@ LOAD_PEOPLE = os.path.join(fetch.STATIC_FILES_DIR, 'load-people.js')
|
|||
MANIFEST = os.path.join(fetch.STATIC_FILES_DIR, 'cache.manifest')
|
||||
NO_PHOTO = os.path.join(fetch.STATIC_FILES_DIR, 'images', 'no-photo.jpg')
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
print 'Writing %s.' % LOAD_PEOPLE
|
||||
|
||||
people = json.load(open(fetch.JSON_FEED_FILENAME, 'r'))
|
||||
|
@ -51,3 +51,6 @@ if __name__ == '__main__':
|
|||
for filename in filenames:
|
||||
f.write('%s%s\n' % (relpath, filename))
|
||||
f.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
5
fetch.py
5
fetch.py
|
@ -69,7 +69,7 @@ def maybe_fetch_thumbnail(email):
|
|||
if e.code != 404:
|
||||
raise
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
config = json.load(open('config.json', 'r'))
|
||||
install_auth_handler(config['username'], config['password'])
|
||||
|
||||
|
@ -80,3 +80,6 @@ if __name__ == '__main__':
|
|||
os.mkdir(THUMBNAIL_DIR)
|
||||
|
||||
fetch_thumbnails([email for email in people])
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Загрузка…
Ссылка в новой задаче