{"id":15636677,"url":"https://github.com/sivel/flask-lambda","last_synced_at":"2025-04-06T02:08:24.633Z","repository":{"id":40617387,"uuid":"77088792","full_name":"sivel/flask-lambda","owner":"sivel","description":"Python module to make Flask compatible with AWS Lambda for creating RESTful applications","archived":false,"fork":false,"pushed_at":"2023-10-21T17:10:33.000Z","size":12,"stargazers_count":120,"open_issues_count":11,"forks_count":62,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-30T00:11:03.450Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sivel.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-21T21:53:36.000Z","updated_at":"2025-03-17T20:18:50.000Z","dependencies_parsed_at":"2024-06-18T21:33:13.721Z","dependency_job_id":"51cda947-737e-493f-b6b1-c9e742213035","html_url":"https://github.com/sivel/flask-lambda","commit_stats":{"total_commits":9,"total_committers":3,"mean_commits":3.0,"dds":0.2222222222222222,"last_synced_commit":"fb60743d02c42fa4faac4c599e2e8093653e23c5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivel%2Fflask-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivel%2Fflask-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivel%2Fflask-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivel%2Fflask-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sivel","download_url":"https://codeload.github.com/sivel/flask-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423514,"owners_count":20936626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T11:06:03.775Z","updated_at":"2025-04-06T02:08:24.610Z","avatar_url":"https://github.com/sivel.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"flask-lambda\n============\n\nPython module to make Flask compatible with AWS Lambda for creating RESTful applications.\n\nInstallation\n------------\n\n::\n\n    pip install flask-lambda\n\nUsage\n-----\n\nThis module works pretty much just like Flask. This allows you to run and develop this applicaiton locally just like you would in Flask.  When ready deploy to Lambda, and configure the handler as::\n\n    my_python_file.app\n\nHere is an example of what ``my_python_file.py`` would look like::\n\n    import json\n    from flask import request\n    from flask_lambda import FlaskLambda\n\n    app = FlaskLambda(__name__)\n\n\n    @app.route('/foo', methods=['GET', 'POST'])\n    def foo():\n        data = {\n            'form': request.form.copy(),\n            'args': request.args.copy(),\n            'json': request.json\n        }\n        return (\n            json.dumps(data, indent=4, sort_keys=True),\n            200,\n            {'Content-Type': 'application/json'}\n        )\n\n\n    if __name__ == '__main__':\n        app.run(debug=True)\n\nFlask-RESTful\n-------------\n\nNothing special here, this module works without issue with Flask-RESTful as well.\n\nAPI Gateway\n-----------\n\nConfigure your API Gateway with a ``{proxy+}`` resource with an ``ANY`` method. Your \"Method Response\" should likely include an ``application/json`` \"Response Body for 200\" that uses the ``Empty`` model.\n\nDeploying\n---------\n\nConsider using `python-mu \u003chttps://github.com/sivel/mu\u003e`_.\n\nLambda Test Event\n-----------------\n\nIf you wish to use the \"Test\" functionality in Lambda for your function, you will need a \"API Gateway AWS Proxy\" event.  Below is an event to test the above sample application::\n\n    {\n      \"body\": \"{\\\"test\\\":\\\"body\\\"}\",\n      \"resource\": \"/{proxy+}\",\n      \"requestContext\": {\n        \"resourceId\": \"123456\",\n        \"apiId\": \"1234567890\",\n        \"resourcePath\": \"/{proxy+}\",\n        \"httpMethod\": \"POST\",\n        \"requestId\": \"c6af9ac6-7b61-11e6-9a41-93e8deadbeef\",\n        \"accountId\": \"123456789012\",\n        \"identity\": {\n          \"apiKey\": null,\n          \"userArn\": null,\n          \"cognitoAuthenticationType\": null,\n          \"caller\": null,\n          \"userAgent\": \"Custom User Agent String\",\n          \"user\": null,\n          \"cognitoIdentityPoolId\": null,\n          \"cognitoIdentityId\": null,\n          \"cognitoAuthenticationProvider\": null,\n          \"sourceIp\": \"127.0.0.1\",\n          \"accountId\": null\n        },\n        \"stage\": \"prod\"\n      },\n      \"queryStringParameters\": {\n        \"foo\": \"bar\"\n      },\n      \"headers\": {\n        \"Via\": \"1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)\",\n        \"Accept-Language\": \"en-US,en;q=0.8\",\n        \"CloudFront-Is-Desktop-Viewer\": \"true\",\n        \"CloudFront-Is-SmartTV-Viewer\": \"false\",\n        \"CloudFront-Is-Mobile-Viewer\": \"false\",\n        \"X-Forwarded-For\": \"127.0.0.1, 127.0.0.2\",\n        \"CloudFront-Viewer-Country\": \"US\",\n        \"Accept\": \"application/json\",\n        \"Upgrade-Insecure-Requests\": \"1\",\n        \"X-Forwarded-Port\": \"443\",\n        \"Host\": \"1234567890.execute-api.us-east-1.amazonaws.com\",\n        \"X-Forwarded-Proto\": \"https\",\n        \"X-Amz-Cf-Id\": \"cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==\",\n        \"CloudFront-Is-Tablet-Viewer\": \"false\",\n        \"Cache-Control\": \"max-age=0\",\n        \"User-Agent\": \"Custom User Agent String\",\n        \"CloudFront-Forwarded-Proto\": \"https\",\n        \"Accept-Encoding\": \"gzip, deflate, sdch\",\n        \"Content-Type\": \"application/json\"\n      },\n      \"pathParameters\": {\n        \"proxy\": \"foo\"\n      },\n      \"httpMethod\": \"POST\",\n      \"stageVariables\": {\n        \"baz\": \"qux\"\n      },\n      \"path\": \"/foo\"\n    }\n\nTo update your test event, click \"Actions\" -\u003e \"Configure test event\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsivel%2Fflask-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsivel%2Fflask-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsivel%2Fflask-lambda/lists"}