Ejemplo n.º 1
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>']
 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>']
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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()