-
Notifications
You must be signed in to change notification settings - Fork 1
/
uploader.py
42 lines (36 loc) · 1.1 KB
/
uploader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import zipfile
import os
import datetime
import boto
from boto.s3.key import Key
def print_info(archive_name):
zf = zipfile.ZipFile(archive_name)
for info in zf.infolist():
print info.filename
print '\tComment:\t', info.comment
print '\tModified:\t', datetime.datetime(*info.date_time)
print '\tSystem:\t\t', info.create_system, '(0 = Windows, 3 = Unix)'
print '\tZIP version:\t', info.create_version
print '\tCompressed:\t', info.compress_size, 'bytes'
print '\tUncompressed:\t', info.file_size, 'bytes'
print
print
print 'CREATING ARCHIVE'
zf = zipfile.ZipFile('Lambda.zip', mode='w')
try:
path = "./"
for root, dirs, files in os.walk(path):
for f in files:
if not f.endswith(".zip"):
print 'ADDING' + os.path.join(root, f)
zf.write(os.path.join(root, f))
finally:
print 'CLOSING ARCHIVE'
zf.close()
print
print_info('Lambda.zip')
# c = boto.connect_s3()
# b = c.create_bucket('forge-06199412')
# k = Key(b)
# k.key = 'lambda_zip'
# k.set_contents_from_filename('Lambda.zip')