<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          mangumAWS Lambda & API Gateway support for ASGI

          聯(lián)合創(chuàng)作 · 2023-09-27 13:07

          Mangum

          Package version Build Status

          PyPI - Python Version

          Mangum is an adapter for using ASGI applications with AWS Lambda & API Gateway. It is intended to provide an easy-to-use, configurable wrapper for any ASGI application deployed in an AWS Lambda function to handle API Gateway requests and responses.

          Documentation: https://mangum.io/

          Features

          • API Gateway support for HTTP, REST, and WebSocket APIs.

          • Multiple storage backend interfaces for managing WebSocket connections.

          • Compatibility with ASGI application frameworks, such as Starlette, FastAPI, and Quart.

          • Support for binary media types and payload compression in API Gateway using GZip or Brotli.

          • Works with existing deployment and configuration tools, including Serverless Framework and AWS SAM.

          • Startup and shutdown lifespan events.

          Requirements

          Python 3.6+

          Installation

          pip install mangum

          Example

          from mangum import Mangum
          
          async def app(scope, receive, send):
              await send(
                  {
                      "type": "http.response.start",
                      "status": 200,
                      "headers": [[b"content-type", b"text/plain; charset=utf-8"]],
                  }
              )
              await send({"type": "http.response.body", "body": b"Hello, world!"})
          
          
          handler = Mangum(app)

          Or using a framework.

          from fastapi import FastAPI
          from mangum import Mangum
          
          app = FastAPI()
          
          
          @app.get("/")
          def read_root():
              return {"Hello": "World"}
          
          
          @app.get("/items/{item_id}")
          def read_item(item_id: int, q: str = None):
              return {"item_id": item_id, "q": q}
          
          handler = Mangum(app)
          瀏覽 10
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  俺来也俺去也www色 | 国产亚洲欧美在线 | ass极品水嫩小泬粉嫩Pⅰc | 久久久久91精品成人片 | 欧美成人网站视频 |