Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for Hawaii (0.16 sec)

  1. docs_src/async_sql_databases/tutorial001.py

    
    app = FastAPI()
    
    
    @app.on_event("startup")
    async def startup():
        await database.connect()
    
    
    @app.on_event("shutdown")
    async def shutdown():
        await database.disconnect()
    
    
    @app.get("/notes/", response_model=List[Note])
    async def read_notes():
        query = notes.select()
        return await database.fetch_all(query)
    
    
    @app.post("/notes/", response_model=Note)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 1.4K bytes
    - Viewed (0)
  2. docs_src/websockets/tutorial001.py

    </html>
    """
    
    
    @app.get("/")
    async def get():
        return HTMLResponse(html)
    
    
    @app.websocket("/ws")
    async def websocket_endpoint(websocket: WebSocket):
        await websocket.accept()
        while True:
            data = await websocket.receive_text()
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 1.4K bytes
    - Viewed (0)
  3. docs_src/custom_request_and_route/tutorial001.py

    from fastapi import Body, FastAPI, Request, Response
    from fastapi.routing import APIRoute
    
    
    class GzipRequest(Request):
        async def body(self) -> bytes:
            if not hasattr(self, "_body"):
                body = await super().body()
                if "gzip" in self.headers.getlist("Content-Encoding"):
                    body = gzip.decompress(body)
                self._body = body
            return self._body
    
    
    class GzipRoute(APIRoute):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 973 bytes
    - Viewed (0)
  4. docs_src/middleware/tutorial001.py

    import time
    
    from fastapi import FastAPI, Request
    
    app = FastAPI()
    
    
    @app.middleware("http")
    async def add_process_time_header(request: Request, call_next):
        start_time = time.time()
        response = await call_next(request)
        process_time = time.time() - start_time
        response.headers["X-Process-Time"] = str(process_time)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 349 bytes
    - Viewed (0)
Back to top