Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 111 for print (0.23 sec)

  1. docs_src/custom_request_and_route/tutorial003.py

                duration = time.time() - before
                response.headers["X-Response-Time"] = str(duration)
                print(f"route duration: {duration}")
                print(f"route response: {response}")
                print(f"route response headers: {response.headers}")
                return response
    
            return custom_route_handler
    
    
    app = FastAPI()
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 1K bytes
    - Viewed (0)
  2. docs_src/python_types/tutorial011.py

    
    external_data = {
        "id": "123",
        "signup_ts": "2017-06-01 12:22",
        "friends": [1, "2", b"3"],
    }
    user = User(**external_data)
    print(user)
    # > User id=123 name='John Doe' signup_ts=datetime.datetime(2017, 6, 1, 12, 22) friends=[1, 2, 3]
    print(user.id)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Sep 02 15:56:35 GMT 2023
    - 498 bytes
    - Viewed (0)
  3. docs_src/handling_errors/tutorial006.py

    
    @app.exception_handler(StarletteHTTPException)
    async def custom_http_exception_handler(request, exc):
        print(f"OMG! An HTTP error!: {repr(exc)}")
        return await http_exception_handler(request, exc)
    
    
    @app.exception_handler(RequestValidationError)
    async def validation_exception_handler(request, exc):
        print(f"OMG! The client sent invalid data!: {exc}")
        return await request_validation_exception_handler(request, exc)
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Aug 09 11:10:33 GMT 2020
    - 928 bytes
    - Viewed (0)
  4. docs_src/python_types/tutorial001.py

    def get_full_name(first_name, last_name):
        full_name = first_name.title() + " " + last_name.title()
        return full_name
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 162 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_response_change_status_code/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_change_status_code.tutorial001 import app
    
    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")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 521 bytes
    - Viewed (0)
  6. docs_src/extra_models/tutorial002_py310.py

        return "supersecret" + raw_password
    
    
    def fake_save_user(user_in: UserIn):
        hashed_password = fake_password_hasher(user_in.password)
        user_in_db = UserInDB(**user_in.dict(), hashed_password=hashed_password)
        print("User saved! ..not really")
        return user_in_db
    
    
    @app.post("/user/", response_model=UserOut)
    async def create_user(user_in: UserIn):
        user_saved = fake_save_user(user_in)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 792 bytes
    - Viewed (0)
  7. docs_src/python_types/tutorial009.py

    from typing import Optional
    
    
    def say_hi(name: Optional[str] = None):
        if name is not None:
            print(f"Hey {name}!")
        else:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 12 21:44:23 GMT 2020
    - 164 bytes
    - Viewed (0)
  8. docs/em/docs/tutorial/handling-errors.md

    ```Python hl_lines="2-5  15  21"
    {!../../../docs_src/handling_errors/tutorial006.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.3K bytes
    - Viewed (0)
  9. docs_src/python_types/tutorial009b.py

    from typing import Union
    
    
    def say_hi(name: Union[str, None] = None):
        if name is not None:
            print(f"Hey {name}!")
        else:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 164 bytes
    - Viewed (0)
  10. docs_src/python_types/tutorial008b.py

    from typing import Union
    
    
    def process_item(item: Union[int, str]):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 84 bytes
    - Viewed (0)
Back to top