Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for Weaver (0.25 sec)

  1. fastapi/security/api_key.py

            return api_key
    
    
    class APIKeyHeader(APIKeyBase):
        """
        API key authentication using a header.
    
        This defines the name of the header that should be provided in the request with
        the API key and integrates that into the OpenAPI documentation. It extracts
        the key value sent in the header automatically and provides it as the dependency
        result. But it doesn't define how to send that key to the client.
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 23 22:29:18 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  2. tests/test_security_oauth2.py

    client = TestClient(app)
    
    
    def test_security_oauth2():
        response = client.get("/users/me", headers={"Authorization": "Bearer footokenbar"})
        assert response.status_code == 200, response.text
        assert response.json() == {"username": "Bearer footokenbar"}
    
    
    def test_security_oauth2_password_other_header():
        response = client.get("/users/me", headers={"Authorization": "Other footokenbar"})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  3. tests/test_security_oauth2_optional_description.py

        description="OAuth2 security scheme",
        auto_error=False,
    )
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: Optional[str] = Security(reusable_oauth2)):
        if oauth_header is None:
            return None
        user = User(username=oauth_header)
        return user
    
    
    @app.post("/login")
    def login(form_data: OAuth2PasswordRequestFormStrict = Depends()):
        return form_data
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.9K bytes
    - Viewed (0)
  4. fastapi/openapi/models.py

            class Config:
                extra = "allow"
    
    
    class ParameterInType(Enum):
        query = "query"
        header = "header"
        path = "path"
        cookie = "cookie"
    
    
    class Encoding(BaseModelWithConfig):
        contentType: Optional[str] = None
        headers: Optional[Dict[str, Union["Header", Reference]]] = None
        style: Optional[str] = None
        explode: Optional[bool] = None
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 22:49:33 GMT 2024
    - 15K bytes
    - Viewed (1)
  5. tests/test_tutorial/test_dependencies/test_tutorial012_an_py39.py

        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    @needs_py39
    def test_get_invalid_second_header_items(client: TestClient):
        response = client.get(
            "/items/", headers={"X-Token": "fake-super-secret-token", "X-Key": "invalid"}
        )
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Key header invalid"}
    
    
    @needs_py39
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.8K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_dependencies/test_tutorial006_an_py39.py

            }
        )
    
    
    @needs_py39
    def test_get_invalid_one_header(client: TestClient):
        response = client.get("/items/", headers={"X-Token": "invalid"})
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    @needs_py39
    def test_get_invalid_second_header(client: TestClient):
        response = client.get(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_bigger_applications/test_main.py

        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    def test_items_bar_with_invalid_token(client: TestClient):
        response = client.get("/items/bar?token=jessica", headers={"X-Token": "invalid"})
        assert response.status_code == 400
        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    def test_items_with_missing_x_token_header(client: TestClient):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.6K bytes
    - Viewed (0)
  8. tests/test_security_oauth2_optional.py

            }
        },
        auto_error=False,
    )
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: Optional[str] = Security(reusable_oauth2)):
        if oauth_header is None:
            return None
        user = User(username=oauth_header)
        return user
    
    
    @app.post("/login")
    def login(form_data: OAuth2PasswordRequestFormStrict = Depends()):
        return form_data
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_dependencies/test_tutorial012.py

    
    def test_get_invalid_second_header_items():
        response = client.get(
            "/items/", headers={"X-Token": "fake-super-secret-token", "X-Key": "invalid"}
        )
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Key header invalid"}
    
    
    def test_get_invalid_second_header_users():
        response = client.get(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_dependencies/test_tutorial006.py

            }
        )
    
    
    def test_get_invalid_one_header():
        response = client.get("/items/", headers={"X-Token": "invalid"})
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    def test_get_invalid_second_header():
        response = client.get(
            "/items/", headers={"X-Token": "fake-super-secret-token", "X-Key": "invalid"}
        )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 5K bytes
    - Viewed (0)
Back to top