def handle(event, context): """ Triggered by adding a file to the cdn.door43.org/temp S3 folder :param dict event: :param context: """ wipe_temp(ignore_errors=True) global logger signer = Signer(ENC_PRIV_PEM_PATH, PUB_KEY_PATH) handler = SigningHandler(event, context, logger, signer) handler.run()
def test_wipe_temp_full(self): files_before = [ name for name in os.listdir(self.temp_dir) if os.path.isfile(name) ] self.assertEqual(0, len(files_before)) wipe_temp(tmp_dir=self.temp_dir) files_after = [ name for name in os.listdir(self.temp_dir) if os.path.isfile(name) ] self.assertTrue(os.path.exists(self.temp_dir)) self.assertEqual(0, len(files_after))
def handle(event, context): # this shouldn't happen, but just in case wipe_temp(ignore_errors=True) if 'Records' not in event: return False for record in event['Records']: # check if this is S3 bucket record if 's3' not in record: return False bucket_name = record['s3']['bucket']['name'] key = record['s3']['object']['key'] url = 'https://{0}/{1}'.format(bucket_name, key) acceptance = AcceptanceHandler(event, context, url, URLHandler, httplib.HTTPConnection, SESHandler) acceptance.run() print(acceptance.errors) return acceptance.errors
def handle(event, context): wipe_temp(ignore_errors=True) catalog = UwV2CatalogHandler(event, context, logger) return catalog.run()
def handle(event, context): wipe_temp(ignore_errors=True) handler = ForkHandler(event, context) return handler.run()
def handle(event, context): wipe_temp(ignore_errors=True) handler = WebhookHandler(event, context, logger) return handler.run()