Search Options

Results per page
Sort
Preferred Languages
Advance

Results 781 - 790 of 1,080 for Str (0.02 sec)

  1. tests/test_request_body_parameters_media_type.py

    media_type = "application/vnd.api+json"
    
    
    # NOTE: These are not valid JSON:API resources
    # but they are fine for testing requestBody with custom media_type
    class Product(BaseModel):
        name: str
        price: float
    
    
    class Shop(BaseModel):
        name: str
    
    
    @app.post("/products")
    async def create_product(data: Product = Body(media_type=media_type, embed=True)):
        pass  # pragma: no cover
    
    
    @app.post("/shops")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 6.4K bytes
    - Viewed (0)
  2. docs/ja/docs/index.md

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: bool = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: str = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 20 19:20:23 UTC 2024
    - 21K bytes
    - Viewed (0)
  3. tests/test_forms_single_param.py

    from fastapi import FastAPI, Form
    from fastapi.testclient import TestClient
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.post("/form/")
    def post_form(username: Annotated[str, Form()]):
        return username
    
    
    client = TestClient(app)
    
    
    def test_single_form_field():
        response = client.post("/form/", data={"username": "Rick"})
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Sep 05 11:24:36 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  4. tests/test_security_oauth2_password_bearer_optional_description.py

    oauth2_scheme = OAuth2PasswordBearer(
        tokenUrl="/token",
        description="OAuth2PasswordBearer security scheme",
        auto_error=False,
    )
    
    
    @app.get("/items/")
    async def read_items(token: Optional[str] = Security(oauth2_scheme)):
        if token is None:
            return {"msg": "Create an account first"}
        return {"token": token}
    
    
    client = TestClient(app)
    
    
    def test_no_token():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  5. docs/es/docs/features.md

    ```Python
    from datetime import date
    
    from pydantic import BaseModel
    
    # Declaras la variable como un str
    # y obtienes soporte del editor dentro de la función
    def main(user_id: str):
        return user_id
    
    
    # Un modelo de Pydantic
    class User(BaseModel):
        id: int
        name: str
        joined: date
    ```
    
    Este puede ser usado como:
    
    ```Python
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Aug 19 18:15:21 UTC 2024
    - 10.9K bytes
    - Viewed (0)
  6. src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java

            return getName();
        }
    
        static String unescape( String str ) throws NumberFormatException, UnsupportedEncodingException {
            char ch;
            int i, j, state, len;
            char[] out;
            byte[] b = new byte[1];
    
            if( str == null ) {
                return null;
            }
    
            len = str.length();
            out = new char[len];
            state = 0;
    Registered: Sun Nov 03 00:10:13 UTC 2024
    - Last Modified: Fri Mar 22 21:10:40 UTC 2019
    - 22.5K bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/path-operation-configuration.md

    /// note | "技术细节"
    
    也可以使用 `from starlette import status` 导入状态码。
    
    **FastAPI** 的`fastapi.status` 和 `starlette.status` 一样,只是快捷方式。实际上,`fastapi.status` 直接继承自 Starlette。
    
    ///
    
    ## `tags` 参数
    
    `tags` 参数的值是由 `str` 组成的 `list` (一般只有一个 `str` ),`tags` 用于为*路径操作*添加标签:
    
    ```Python hl_lines="17  22  27"
    {!../../docs_src/path_operation_configuration/tutorial002.py!}
    ```
    
    OpenAPI 概图会自动添加标签,供 API 文档接口使用:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  8. compat/maven-compat/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java

            }
    
            public String getBaseVersion() {
                return nullify(metadata.getVersion());
            }
    
            private String nullify(String str) {
                return (str == null || str.isEmpty()) ? null : str;
            }
    
            public Object getKey() {
                return metadata.toString();
            }
    
            public String getRemoteFilename() {
    Registered: Sun Nov 03 03:35:11 UTC 2024
    - Last Modified: Fri Oct 25 12:31:46 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  9. docs/ko/docs/index.md

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 16 16:50:01 UTC 2024
    - 19.4K bytes
    - Viewed (0)
  10. tests/test_additional_properties.py

    from typing import Dict
    
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Items(BaseModel):
        items: Dict[str, int]
    
    
    @app.post("/foo")
    def foo(items: Items):
        return items.items
    
    
    client = TestClient(app)
    
    
    def test_additional_properties_post():
        response = client.post("/foo", json={"items": {"foo": 1, "bar": 2}})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.6K bytes
    - Viewed (0)
Back to top