Learning dependency injection with FastAPI's Depends

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • fastapi

    FastAPI framework, high performance, easy to learn, fast to code, ready for production

  • from typing import Union from fastapi import FastAPI, Header, HTTPException app = FastAPI() @app.get("/whoami") async def who_am_i(x_api_key: Union[str, None] = Header(default=None), ): if x_api_key is None: raise HTTPException(status_code=401) # See https://fastapi.tiangolo.com/tutorial/sql-databases/ for details on SessionLocal db = SessionLocal() try: api_key = lookup_api_key(db, x_api_key) if api_key is None: raise HTTPException(status_code=401) return {"user": api_key.user_id} finally: db.close()

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts