Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 53 for decoder (0.17 sec)

  1. docs_src/custom_request_and_route/tutorial002.py

                    return await original_route_handler(request)
                except RequestValidationError as exc:
                    body = await request.body()
                    detail = {"errors": exc.errors(), "body": body.decode()}
                    raise HTTPException(status_code=422, detail=detail)
    
            return custom_route_handler
    
    
    app = FastAPI()
    app.router.route_class = ValidationErrorLoggingRoute
    
    
    @app.post("/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 932 bytes
    - Viewed (0)
  2. docs/select/select.py

            },
            'CompressionType': 'GZIP',
        },
        OutputSerialization={'CSV': {}},
    )
    
    for event in r['Payload']:
        if 'Records' in event:
            records = event['Records']['Payload'].decode('utf-8')
            print(records)
        elif 'Stats' in event:
            statsDetails = event['Stats']['Details']
            print("Stats details bytesScanned: ")
            print(statsDetails['BytesScanned'])
    Python
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sat Aug 18 00:11:39 GMT 2018
    - 1K bytes
    - Viewed (0)
  3. docs_src/body_updates/tutorial001.py

    from typing import List, Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: Union[str, None] = None
        description: Union[str, None] = None
        price: Union[float, None] = None
        tax: float = 10.5
        tags: List[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 906 bytes
    - Viewed (0)
  4. docs_src/body_updates/tutorial001_py310.py

    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str | None = None
        description: str | None = None
        price: float | None = None
        tax: float = 10.5
        tags: list[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
        "bar": {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20.2},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 856 bytes
    - Viewed (0)
  5. docs_src/body_updates/tutorial002.py

    from typing import List, Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: Union[str, None] = None
        description: Union[str, None] = None
        price: Union[float, None] = None
        tax: float = 10.5
        tags: List[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 1K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_security/test_tutorial006_an.py

        assert response.json() == {"detail": "Invalid authentication credentials"}
    
    
    def test_security_http_basic_non_basic_credentials():
        payload = b64encode(b"johnsecret").decode("ascii")
        auth_header = f"Basic {payload}"
        response = client.get("/users/me", headers={"Authorization": auth_header})
        assert response.status_code == 401, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.3K bytes
    - Viewed (0)
  7. tests/test_security_http_basic_realm_description.py

        assert response.json() == {"detail": "Invalid authentication credentials"}
    
    
    def test_security_http_basic_non_basic_credentials():
        payload = b64encode(b"johnsecret").decode("ascii")
        auth_header = f"Basic {payload}"
        response = client.get("/users/me", headers={"Authorization": auth_header})
        assert response.status_code == 401, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  8. docs_src/security/tutorial004_an_py310.py

            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Could not validate credentials",
            headers={"WWW-Authenticate": "Bearer"},
        )
        try:
            payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
            username: str = payload.get("sub")
            if username is None:
                raise credentials_exception
            token_data = TokenData(username=username)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  9. docs_src/security/tutorial005_an.py

            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Could not validate credentials",
            headers={"WWW-Authenticate": authenticate_value},
        )
        try:
            payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
            username: str = payload.get("sub")
            if username is None:
                raise credentials_exception
            token_scopes = payload.get("scopes", [])
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  10. tests/test_jsonable_encoder.py

        pet = {"name": "Firulais", "owner": {"name": "Foo"}}
        assert jsonable_encoder(pet) == {"name": "Firulais", "owner": {"name": "Foo"}}
        assert jsonable_encoder(pet, include={"name"}) == {"name": "Firulais"}
        assert jsonable_encoder(pet, exclude={"owner"}) == {"name": "Firulais"}
        assert jsonable_encoder(pet, include={}) == {}
        assert jsonable_encoder(pet, exclude={}) == {
            "name": "Firulais",
            "owner": {"name": "Foo"},
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 9K bytes
    - Viewed (0)
Back to top