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 __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()