Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 1,117 for from (0.14 sec)

  1. tests/test_forms_from_non_typing_sequences.py

    from fastapi import FastAPI, Form
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.post("/form/python-list")
    def post_form_param_list(items: list = Form()):
        return items
    
    
    @app.post("/form/python-set")
    def post_form_param_set(items: set = Form()):
        return items
    
    
    @app.post("/form/python-tuple")
    def post_form_param_tuple(items: tuple = Form()):
        return items
    
    
    client = TestClient(app)
    
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 1.2K bytes
    - Viewed (0)
  2. docs_src/security/tutorial005_an_py310.py

    from datetime import datetime, timedelta, timezone
    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException, Security, status
    from fastapi.security import (
        OAuth2PasswordBearer,
        OAuth2PasswordRequestForm,
        SecurityScopes,
    )
    from jose import JWTError, jwt
    from passlib.context import CryptContext
    from pydantic import BaseModel, ValidationError
    
    # to get a string like this run:
    # openssl rand -hex 32
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 5.2K bytes
    - Viewed (0)
  3. docs_src/security/tutorial005_py310.py

    from datetime import datetime, timedelta, timezone
    
    from fastapi import Depends, FastAPI, HTTPException, Security, status
    from fastapi.security import (
        OAuth2PasswordBearer,
        OAuth2PasswordRequestForm,
        SecurityScopes,
    )
    from jose import JWTError, jwt
    from passlib.context import CryptContext
    from pydantic import BaseModel, ValidationError
    
    # to get a string like this run:
    # openssl rand -hex 32
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 5.1K bytes
    - Viewed (0)
  4. docs_src/request_files/tutorial003_an_py39.py

    
    @app.get("/")
    async def main():
        content = """
    <body>
    <form action="/files/" enctype="multipart/form-data" method="post">
    <input name="files" type="file" multiple>
    <input type="submit">
    </form>
    <form action="/uploadfiles/" enctype="multipart/form-data" method="post">
    <input name="files" type="file" multiple>
    <input type="submit">
    </form>
    </body>
        """
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 952 bytes
    - Viewed (0)
  5. docs_src/security/tutorial003.py

    from typing import Union
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
    from pydantic import BaseModel
    
    fake_users_db = {
        "johndoe": {
            "username": "johndoe",
            "full_name": "John Doe",
            "email": "******@****.***",
            "hashed_password": "fakehashedsecret",
            "disabled": False,
        },
        "alice": {
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 2.4K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_testing_dependencies/test_tutorial001_an_py310.py

    from ...utils import needs_py310
    
    
    @needs_py310
    def test_override_in_items_run():
        from docs_src.dependency_testing.tutorial001_an_py310 import test_override_in_items
    
        test_override_in_items()
    
    
    @needs_py310
    def test_override_in_items_with_q_run():
        from docs_src.dependency_testing.tutorial001_an_py310 import (
            test_override_in_items_with_q,
        )
    
        test_override_in_items_with_q()
    
    
    @needs_py310
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 2K bytes
    - Viewed (0)
  7. docs_src/encoder/tutorial001.py

    from datetime import datetime
    from typing import Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    fake_db = {}
    
    
    class Item(BaseModel):
        title: str
        timestamp: datetime
        description: Union[str, None] = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{id}")
    def update_item(id: str, item: Item):
        json_compatible_item_data = jsonable_encoder(item)
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 461 bytes
    - Viewed (0)
  8. docs_src/security/tutorial002_an.py

    from typing import Union
    
    from fastapi import Depends, FastAPI
    from fastapi.security import OAuth2PasswordBearer
    from pydantic import BaseModel
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
    
    
    class User(BaseModel):
        username: str
        email: Union[str, None] = None
        full_name: Union[str, None] = None
        disabled: Union[bool, None] = None
    
    
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 815 bytes
    - Viewed (0)
  9. tests/test_datastructures.py

    import io
    from pathlib import Path
    from typing import List
    
    import pytest
    from fastapi import FastAPI, UploadFile
    from fastapi.datastructures import Default
    from fastapi.testclient import TestClient
    
    
    # TODO: remove when deprecating Pydantic v1
    def test_upload_file_invalid():
        with pytest.raises(ValueError):
            UploadFile.validate("not a Starlette UploadFile")
    
    
    def test_upload_file_invalid_pydantic_v2():
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 2K bytes
    - Viewed (0)
  10. tests/test_validate_response_dataclass.py

    from typing import List, Optional
    
    import pytest
    from fastapi import FastAPI
    from fastapi.exceptions import ResponseValidationError
    from fastapi.testclient import TestClient
    from pydantic.dataclasses import dataclass
    
    app = FastAPI()
    
    
    @dataclass
    class Item:
        name: str
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    
    @app.get("/items/invalid", response_model=Item)
    def get_invalid():
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.2K bytes
    - Viewed (0)
Back to top