- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 38 for Case (0.12 sec)
-
docs_src/sql_databases/sql_app/tests/test_sql_app.py
from sqlalchemy.pool import StaticPool from ..database import Base from ..main import app, get_db SQLALCHEMY_DATABASE_URL = "sqlite://" engine = create_engine( SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}, poolclass=StaticPool, ) TestingSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) Base.metadata.create_all(bind=engine) def override_get_db():
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Jun 22 11:20:12 GMT 2023 - 1.2K bytes - Viewed (0) -
docs_src/sql_databases/sql_app_py310/main.py
from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: yield db finally: db.close() @app.post("/users/", response_model=schemas.User)
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 1.6K bytes - Viewed (0) -
fastapi/security/api_key.py
from typing import Optional from fastapi.openapi.models import APIKey, APIKeyIn from fastapi.security.base import SecurityBase from starlette.exceptions import HTTPException from starlette.requests import Request from starlette.status import HTTP_403_FORBIDDEN from typing_extensions import Annotated, Doc class APIKeyBase(SecurityBase): pass class APIKeyQuery(APIKeyBase): """
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Apr 23 22:29:18 GMT 2024 - 9.1K bytes - Viewed (0) -
tests/test_security_http_base_description.py
client = TestClient(app) def test_security_http_base(): response = client.get("/users/me", headers={"Authorization": "Other foobar"}) assert response.status_code == 200, response.text assert response.json() == {"scheme": "Other", "credentials": "foobar"} def test_security_http_base_no_credentials(): response = client.get("/users/me")
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jun 30 18:25:16 GMT 2023 - 1.9K bytes - Viewed (0) -
fastapi/applications.py
from starlette.applications import Starlette from starlette.datastructures import State from starlette.exceptions import HTTPException from starlette.middleware import Middleware from starlette.middleware.base import BaseHTTPMiddleware from starlette.requests import Request from starlette.responses import HTMLResponse, JSONResponse, Response from starlette.routing import BaseRoute
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Apr 02 02:48:51 GMT 2024 - 172.2K bytes - Viewed (0) -
docs_src/sql_databases/sql_app_py39/database.py
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db" # SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db" engine = create_engine( SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} ) SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 461 bytes - Viewed (0) -
tests/test_tutorial/test_advanced_middleware/test_tutorial002.py
def test_middleware(): client = TestClient(app, base_url="http://example.com") response = client.get("/") assert response.status_code == 200, response.text client = TestClient(app, base_url="http://subdomain.example.com") response = client.get("/") assert response.status_code == 200, response.text client = TestClient(app, base_url="http://invalidhost") response = client.get("/")
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Jul 09 18:06:12 GMT 2020 - 570 bytes - Viewed (0) -
docs_src/sql_databases/sql_app/models.py
from sqlalchemy.orm import relationship from .database import Base class User(Base): __tablename__ = "users" id = Column(Integer, primary_key=True) email = Column(String, unique=True, index=True) hashed_password = Column(String) is_active = Column(Boolean, default=True) items = relationship("Item", back_populates="owner") class Item(Base): __tablename__ = "items"
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Jan 09 14:35:33 GMT 2024 - 710 bytes - Viewed (0) -
tests/test_no_swagger_ui_redirect.py
response = client.get("/docs") assert response.status_code == 200, response.text assert response.headers["content-type"] == "text/html; charset=utf-8" assert "swagger-ui-dist" in response.text print(client.base_url) assert "oauth2RedirectUrl" not in response.text def test_swagger_ui_no_oauth2_redirect(): response = client.get("/docs/oauth2-redirect") assert response.status_code == 404, response.text
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Wed Apr 08 04:37:38 GMT 2020 - 786 bytes - Viewed (0) -
tests/test_custom_swagger_ui_redirect.py
response = client.get("/docs") assert response.status_code == 200, response.text assert response.headers["content-type"] == "text/html; charset=utf-8" assert "swagger-ui-dist" in response.text print(client.base_url) assert ( f"oauth2RedirectUrl: window.location.origin + '{swagger_ui_oauth2_redirect_url}'" in response.text ) def test_swagger_ui_oauth2_redirect():
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Wed Apr 08 04:37:38 GMT 2020 - 1.1K bytes - Viewed (0)