Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for Mask (0.14 sec)

  1. tests/test_tutorial/test_response_change_status_code/test_tutorial001.py

    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.put("/get-or-create-task/foo")
        print(response.content)
        assert response.status_code == 200, response.text
        assert response.json() == "Listen to the Bar Fighters"
        response = client.put("/get-or-create-task/bar")
        assert response.status_code == 201, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 521 bytes
    - Viewed (0)
  2. docs_src/background_tasks/tutorial002_an_py310.py

        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    async def send_notification(
        email: str, background_tasks: BackgroundTasks, q: Annotated[str, Depends(get_query)]
    ):
        message = f"message to {email}\n"
        background_tasks.add_task(write_log, message)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 683 bytes
    - Viewed (1)
  3. docs_src/background_tasks/tutorial002_py310.py

        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    async def send_notification(
        email: str, background_tasks: BackgroundTasks, q: str = Depends(get_query)
    ):
        message = f"message to {email}\n"
        background_tasks.add_task(write_log, message)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 643 bytes
    - Viewed (0)
  4. fastapi/dependencies/utils.py

                    ) -> None:
                        result = await fn()
                        results.append(result)  # noqa: B023
    
                    async with anyio.create_task_group() as tg:
                        for sub_value in value:
                            tg.start_soon(process_fn, sub_value.read)
                    value = serialize_sequence_value(field=field, value=results)
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  5. docs_src/response_change_status_code/tutorial001.py

    app = FastAPI()
    
    tasks = {"foo": "Listen to the Bar Fighters"}
    
    
    @app.put("/get-or-create-task/{task_id}", status_code=200)
    def get_or_create_task(task_id: str, response: Response):
        if task_id not in tasks:
            tasks[task_id] = "This didn't exist before"
            response.status_code = status.HTTP_201_CREATED
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 391 bytes
    - Viewed (0)
  6. docs_src/background_tasks/tutorial002_an.py

        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    async def send_notification(
        email: str, background_tasks: BackgroundTasks, q: Annotated[str, Depends(get_query)]
    ):
        message = f"message to {email}\n"
        background_tasks.add_task(write_log, message)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 725 bytes
    - Viewed (0)
  7. docs_src/background_tasks/tutorial002.py

        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    async def send_notification(
        email: str, background_tasks: BackgroundTasks, q: str = Depends(get_query)
    ):
        message = f"message to {email}\n"
        background_tasks.add_task(write_log, message)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 675 bytes
    - Viewed (0)
  8. docs_src/background_tasks/tutorial001.py

            email_file.write(content)
    
    
    @app.post("/send-notification/{email}")
    async def send_notification(email: str, background_tasks: BackgroundTasks):
        background_tasks.add_task(write_notification, email, message="some notification")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 519 bytes
    - Viewed (0)
  9. tests/test_dependency_contextmanager.py

    async def get_context_b_bg(tasks: BackgroundTasks, state: dict = Depends(context_b)):
        async def bg(state: dict):
            state["bg"] = f"bg set - b: {state['context_b']} - a: {state['context_a']}"
    
        tasks.add_task(bg, state)
        return state
    
    
    # Sync versions
    
    
    @app.get("/sync_async")
    def get_sync_async(state: str = Depends(asyncgen_state)):
        return state
    
    
    @app.get("/sync_sync")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  10. fastapi/background.py

        async def send_notification(email: str, background_tasks: BackgroundTasks):
            background_tasks.add_task(write_notification, email, message="some notification")
            return {"message": "Notification sent in the background"}
        ```
        """
    
        def add_task(
            self,
            func: Annotated[
                Callable[P, Any],
                Doc(
                    """
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 1.7K bytes
    - Viewed (0)
Back to top