Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 221 for Hosken (0.18 sec)

  1. tests/test_tutorial/test_security/test_tutorial005_py39.py

                        },
                    },
                    "Token": {
                        "title": "Token",
                        "required": ["access_token", "token_type"],
                        "type": "object",
                        "properties": {
                            "access_token": {"title": "Access Token", "type": "string"},
                            "token_type": {"title": "Token Type", "type": "string"},
                        },
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.3K bytes
    - Viewed (0)
  2. docs_src/security/tutorial004_an_py310.py

                headers={"WWW-Authenticate": "Bearer"},
            )
        access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)
        access_token = create_access_token(
            data={"sub": user.username}, expires_delta=access_token_expires
        )
        return Token(access_token=access_token, token_type="bearer")
    
    
    @app.get("/users/me/", response_model=User)
    async def read_users_me(
    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)
  3. docs_src/security/tutorial005_an.py

            data={"sub": user.username, "scopes": form_data.scopes},
            expires_delta=access_token_expires,
        )
        return Token(access_token=access_token, token_type="bearer")
    
    
    @app.get("/users/me/", response_model=User)
    async def read_users_me(
        current_user: Annotated[User, Depends(get_current_active_user)],
    ):
        return current_user
    
    
    @app.get("/users/me/items/")
    async def read_own_items(
    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)
  4. tests/test_tutorial/test_websockets/test_tutorial002_an_py39.py

        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/items/bar/ws?token=some-token") as websocket:
                message = "Message one"
                websocket.send_text(message)
                data = websocket.receive_text()
                assert data == "Session cookie or query token value is: some-token"
                data = websocket.receive_text()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  5. docs_src/app_testing/app_b/test_main.py

    
    def test_read_item():
        response = client.get("/items/foo", headers={"X-Token": "coneofsilence"})
        assert response.status_code == 200
        assert response.json() == {
            "id": "foo",
            "title": "Foo",
            "description": "There goes my hero",
        }
    
    
    def test_read_item_bad_token():
        response = client.get("/items/foo", headers={"X-Token": "hailhydra"})
        assert response.status_code == 400
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  6. docs/en/docs/tutorial/security/first-steps.md

    !!! tip
        Here `tokenUrl="token"` refers to a relative URL `token` that we haven't created yet. As it's a relative URL, it's equivalent to `./token`.
    
        Because we are using a relative URL, if your API was located at `https://example.com/`, then it would refer to `https://example.com/token`. But if your API was located at `https://example.com/api/v1/`, then it would refer to `https://example.com/api/v1/token`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 8.9K bytes
    - Viewed (0)
  7. docs_src/dependencies/tutorial006_an.py

    from fastapi import Depends, FastAPI, Header, HTTPException
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    async def verify_token(x_token: Annotated[str, Header()]):
        if x_token != "fake-super-secret-token":
            raise HTTPException(status_code=400, detail="X-Token header invalid")
    
    
    async def verify_key(x_key: Annotated[str, Header()]):
        if x_key != "fake-super-secret-key":
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 643 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_header_params/test_tutorial003_an.py

    @pytest.mark.parametrize(
        "path,headers,expected_status,expected_response",
        [
            ("/items", None, 200, {"X-Token values": None}),
            ("/items", {"x-token": "foo"}, 200, {"X-Token values": ["foo"]}),
            # TODO: fix this, is it a bug?
            # ("/items", [("x-token", "foo"), ("x-token", "bar")], 200, {"X-Token values": ["foo", "bar"]}),
        ],
    )
    def test(path, headers, expected_status, expected_response):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.1K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_request_forms_and_files/test_tutorial001_an.py

                    },
                    {
                        "loc": ["body", "token"],
                        "msg": "field required",
                        "type": "value_error.missing",
                    },
                ]
            }
        )
    
    
    def test_post_form_no_file(client: TestClient):
        response = client.post("/files/", data={"token": "foo"})
        assert response.status_code == 422, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/security/oauth2-jwt.md

    But it's signed. So, when you receive a token that you emitted, you can verify that you actually emitted it.
    
    That way, you can create a token with an expiration of, let's say, 1 week. And then when the user comes back the next day with the token, you know that user is still logged in to your system.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 13K bytes
    - Viewed (0)
Back to top