コード例 #1
0
ファイル: endpoint.py プロジェクト: BarisGece/python-octo-moo
 def application(env, start_response):
     content_actor = Importer()
     content_actor.start()
     if env['PATH_INFO'] == '/new_content':
         start_response('200 OK', [('Content-Type', 'application/json')])
         content_actor.inbox.put("new_content")
         return [b'''ok''']
     else:
         start_response('404 Not Found', [('Content-Type', 'text/html')])
         return [b'<h1>Not Found</h1>']
コード例 #2
0
 def application(env, start_response):
     content_actor = Importer()
     content_actor.start()
     if env['PATH_INFO'] == '/new_content':
         start_response('200 OK', [('Content-Type', 'application/json')])
         content_actor.inbox.put("new_content")
         return [b'''ok''']
     else:
         start_response('404 Not Found', [('Content-Type', 'text/html')])
         return [b'<h1>Not Found</h1>']
コード例 #3
0
class ContentLocalImporter(object):

    def __init__(self):
        conn = boto.connect_s3(config['aws_access_key'], config['aws_secret_key'])
        self.bucket = conn.get_bucket(config['s3_bucket_name'])
        self.new_content_notifier = Importer()
        self.new_content_notifier.start()

    def get_content_list(self):
        return self.bucket.list()

    def download_files(self):
        contents = self.get_content_list()
        for content in contents:
            keyString = str(content.key)
            if not os.path.exists(config['download_path']+keyString):
                content.get_contents_to_filename(config['download_path']+keyString)
                self.new_content_notifier.inbox.put(config['download_path']+keyString)
コード例 #4
0
class ContentLocalImporter(object):
    def __init__(self):
        conn = boto.connect_s3(config['aws_access_key'],
                               config['aws_secret_key'])
        self.bucket = conn.get_bucket(config['s3_bucket_name'])
        self.new_content_notifier = Importer()
        self.new_content_notifier.start()

    def get_content_list(self):
        return self.bucket.list()

    def download_files(self):
        contents = self.get_content_list()
        for content in contents:
            keyString = str(content.key)
            if not os.path.exists(config['download_path'] + keyString):
                content.get_contents_to_filename(config['download_path'] +
                                                 keyString)
                self.new_content_notifier.inbox.put(config['download_path'] +
                                                    keyString)
コード例 #5
0
 def __init__(self):
     conn = boto.connect_s3(config['aws_access_key'],
                            config['aws_secret_key'])
     self.bucket = conn.get_bucket(config['s3_bucket_name'])
     self.new_content_notifier = Importer()
     self.new_content_notifier.start()
コード例 #6
0
 def __init__(self):
     conn = boto.connect_s3(config['aws_access_key'], config['aws_secret_key'])
     self.bucket = conn.get_bucket(config['s3_bucket_name'])
     self.new_content_notifier = Importer()
     self.new_content_notifier.start()