-
Notifications
You must be signed in to change notification settings - Fork 1
/
s3watcher-server
executable file
·33 lines (26 loc) · 1.02 KB
/
s3watcher-server
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
#!/usr/bin/env python3
from argparse import ArgumentParser
import asyncio
import logging
from s3watcher.server import S3Watcher
def main():
aparser = ArgumentParser(
description='Image S3 bucket watch service')
aparser.add_argument('bucket', metavar='BUCKET',
help='S3 bucket name')
aparser.add_argument('queue_url', metavar='QUEUE', nargs='?',
help='SQS queue URL')
aparser.add_argument('--region', help='S3 region')
aparser.add_argument('--session', action='store_true',
help='use DBus session bus')
aparser.add_argument('--debug', action='store_true',
help='enable debug messages')
args = aparser.parse_args()
logging.basicConfig(level=logging.INFO)
if args.debug:
logger = logging.getLogger('s3watcher')
logger.setLevel(logging.DEBUG)
watcher = S3Watcher(args.bucket, args.queue_url, args.region)
asyncio.run(watcher.run())
if __name__ == '__main__':
main()