Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 1,016 for Description (0.19 sec)

  1. tests/test_security_openid_connect_description.py

    from fastapi.security.open_id_connect_url import OpenIdConnect
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    oid = OpenIdConnect(
        openIdConnectUrl="/openid", description="OpenIdConnect security scheme"
    )
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: str = Security(oid)):
        user = User(username=oauth_header)
        return user
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.4K bytes
    - Viewed (0)
  2. tests/test_security_http_bearer_description.py

    from fastapi import FastAPI, Security
    from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    security = HTTPBearer(description="HTTP Bearer token scheme")
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPAuthorizationCredentials = Security(security)):
        return {"scheme": credentials.scheme, "credentials": credentials.credentials}
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  3. tests/test_security_http_digest_description.py

    from fastapi import FastAPI, Security
    from fastapi.security import HTTPAuthorizationCredentials, HTTPDigest
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    security = HTTPDigest(description="HTTPDigest scheme")
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPAuthorizationCredentials = Security(security)):
        return {"scheme": credentials.scheme, "credentials": credentials.credentials}
    
    
    client = TestClient(app)
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  4. tests/test_security_api_key_cookie_description.py

    from fastapi import Depends, FastAPI, Security
    from fastapi.security import APIKeyCookie
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyCookie(name="key", description="An API Cookie Key")
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: str = Security(api_key)):
        user = User(username=oauth_header)
        return user
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  5. tests/test_security_http_base_description.py

    from fastapi import FastAPI, Security
    from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBase
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    security = HTTPBase(scheme="Other", description="Other Security Scheme")
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPAuthorizationCredentials = Security(security)):
        return {"scheme": credentials.scheme, "credentials": credentials.credentials}
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.9K bytes
    - Viewed (0)
  6. tests/test_security_http_basic_realm_description.py

    from fastapi import FastAPI, Security
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    security = HTTPBasic(realm="simple", description="HTTPBasic scheme")
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPBasicCredentials = Security(security)):
        return {"username": credentials.username, "password": credentials.password}
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  7. tests/test_security_oauth2_password_bearer_optional_description.py

    from fastapi import FastAPI, Security
    from fastapi.security import OAuth2PasswordBearer
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    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:
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  8. tests/test_security_api_key_query_description.py

    from fastapi import Depends, FastAPI, Security
    from fastapi.security import APIKeyQuery
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyQuery(name="key", description="API Key Query")
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: str = Security(api_key)):
        user = User(username=oauth_header)
        return user
    
    
    @app.get("/users/me")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2K bytes
    - Viewed (0)
  9. tests/test_security_api_key_header_description.py

    from fastapi import Depends, FastAPI, Security
    from fastapi.security import APIKeyHeader
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyHeader(name="key", description="An API Key Header")
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: str = Security(api_key)):
        user = User(username=oauth_header)
        return user
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2K bytes
    - Viewed (0)
  10. tests/test_security_oauth2_authorization_code_bearer_description.py

    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2AuthorizationCodeBearer(
        authorizationUrl="authorize",
        tokenUrl="token",
        description="OAuth2 Code Bearer",
        auto_error=True,
    )
    
    
    @app.get("/items/")
    async def read_items(token: Optional[str] = Security(oauth2_scheme)):
        return {"token": token}
    
    
    client = TestClient(app)
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.4K bytes
    - Viewed (0)
Back to top