Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 199 for tax (0.17 sec)

  1. docs_src/body/tutorial002_py310.py

    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    app = FastAPI()
    
    
    @app.post("/items/")
    async def create_item(item: Item):
        item_dict = item.dict()
        if item.tax:
            price_with_tax = item.price + item.tax
            item_dict.update({"price_with_tax": price_with_tax})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 429 bytes
    - Viewed (0)
  2. docs_src/response_model/tutorial006.py

        name: str
        description: Union[str, None] = None
        price: float
        tax: float = 10.5
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
        "bar": {"name": "Bar", "description": "The Bar fighters", "price": 62, "tax": 20.2},
        "baz": {
            "name": "Baz",
            "description": "There goes my baz",
            "price": 50.2,
            "tax": 10.5,
        },
    }
    
    
    @app.get(
        "/items/{item_id}/name",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 848 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_schema_extra_example/test_tutorial004_an_py310.py

                            ),
                            "price": {"title": "Price", "type": "number"},
                            "tax": IsDict(
                                {
                                    "title": "Tax",
                                    "anyOf": [{"type": "number"}, {"type": "null"}],
                                }
                            )
                            | IsDict(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  4. docs_src/path_operation_configuration/tutorial005.py

        """
        Create an item with all the information:
    
        - **name**: each item must have a name
        - **description**: a long description
        - **price**: required
        - **tax**: if the item doesn't have tax, you can omit this
        - **tags**: a set of unique tag strings for this item
        """
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 741 bytes
    - Viewed (0)
  5. docs_src/response_model/tutorial004.py

    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        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},
        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 633 bytes
    - Viewed (0)
  6. docs_src/body_updates/tutorial001_py39.py

        description: Union[str, None] = None
        price: Union[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},
        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 900 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_body/test_tutorial001.py

            "name": "Foo",
            "price": 50.5,
            "description": "Some Foo",
            "tax": None,
        }
    
    
    def test_post_with_str_float_description_tax(client: TestClient):
        response = client.post(
            "/items/",
            json={"name": "Foo", "price": "50.5", "description": "Some Foo", "tax": 0.3},
        )
        assert response.status_code == 200
        assert response.json() == {
            "name": "Foo",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 14.7K bytes
    - Viewed (5)
  8. tests/test_tutorial/test_body/test_tutorial001_py310.py

            "name": "Foo",
            "price": 50.5,
            "description": "Some Foo",
            "tax": None,
        }
    
    
    @needs_py310
    def test_post_with_str_float_description_tax(client: TestClient):
        response = client.post(
            "/items/",
            json={"name": "Foo", "price": "50.5", "description": "Some Foo", "tax": 0.3},
        )
        assert response.status_code == 200
        assert response.json() == {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 15K bytes
    - Viewed (2)
  9. tests/test_tutorial/test_schema_extra_example/test_tutorial005_an.py

                            ),
                            "price": {"title": "Price", "type": "number"},
                            "tax": IsDict(
                                {
                                    "title": "Tax",
                                    "anyOf": [{"type": "number"}, {"type": "null"}],
                                }
                            )
                            | IsDict(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Aug 26 18:03:13 GMT 2023
    - 6.7K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_schema_extra_example/test_tutorial001_pv1.py

                            "description": {"type": "string", "title": "Description"},
                            "price": {"type": "number", "title": "Price"},
                            "tax": {"type": "number", "title": "Tax"},
                        },
                        "type": "object",
                        "required": ["name", "price"],
                        "title": "Item",
                        "examples": [
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.4K bytes
    - Viewed (0)
Back to top