Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 94 for FORM (0.17 sec)

  1. docs_src/request_files/tutorial002_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 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 786 bytes
    - Viewed (0)
  2. docs_src/request_files/tutorial003_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 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 888 bytes
    - Viewed (0)
  3. tests/test_tuples.py

        assert response.status_code == 422, response.text
    
    
    def test_tuple_form_valid():
        response = client.post("/tuple-form/", data={"values": ("1", "2")})
        assert response.status_code == 200, response.text
        assert response.json() == [1, 2]
    
    
    def test_tuple_form_invalid():
        response = client.post("/tuple-form/", data={"values": ("1", "2", "3")})
        assert response.status_code == 422, response.text
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 11.8K bytes
    - Viewed (0)
  4. docs_src/request_forms/tutorial001.py

    from fastapi import FastAPI, Form
    
    app = FastAPI()
    
    
    @app.post("/login/")
    async def login(username: str = Form(), password: str = Form()):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 173 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_request_forms/test_tutorial001.py

        client = TestClient(app)
        return client
    
    
    def test_post_body_form(client: TestClient):
        response = client.post("/login/", data={"username": "Foo", "password": "secret"})
        assert response.status_code == 200
        assert response.json() == {"username": "Foo"}
    
    
    def test_post_body_form_no_password(client: TestClient):
        response = client.post("/login/", data={"username": "Foo"})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.5K bytes
    - Viewed (0)
  6. fastapi/__init__.py

    from .param_functions import Body as Body
    from .param_functions import Cookie as Cookie
    from .param_functions import Depends as Depends
    from .param_functions import File as File
    from .param_functions import Form as Form
    from .param_functions import Header as Header
    from .param_functions import Path as Path
    from .param_functions import Query as Query
    from .param_functions import Security as Security
    from .requests import Request as Request
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:31:47 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  7. docs_src/security/tutorial005_an.py

        return current_user
    
    
    @app.post("/token")
    async def login_for_access_token(
        form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
    ) -> Token:
        user = authenticate_user(fake_users_db, form_data.username, form_data.password)
        if not user:
            raise HTTPException(status_code=400, detail="Incorrect username or password")
    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)
  8. tests/test_tutorial/test_request_files/test_tutorial002.py

    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.request_files.tutorial002 import app
    
    client = TestClient(app)
    
    
    def test_post_form_no_body():
        response = client.post("/files/")
        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
                        "type": "missing",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.5K bytes
    - Viewed (0)
  9. docs_src/security/tutorial004_an_py310.py

        return current_user
    
    
    @app.post("/token")
    async def login_for_access_token(
        form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
    ) -> Token:
        user = authenticate_user(fake_users_db, form_data.username, form_data.password)
        if not user:
            raise HTTPException(
                status_code=status.HTTP_401_UNAUTHORIZED,
    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)
  10. tests/test_schema_extra_examples.py

                return item
    
        # TODO: enable these tests once/if Form(embed=False) is supported
        # TODO: In that case, define if File() should support example/examples too
        # @app.post("/form_example")
        # def form_example(firstname: str = Form(example="John")):
        #     return firstname
    
        # @app.post("/form_examples")
        # def form_examples(
        #     lastname: str = Form(
        #         ...,
        #         examples={
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 37.7K bytes
    - Viewed (0)
Back to top