Saravanan666/pypi-org huggingface dataset:
Package: fastapi-builder
「 FastAPI Builder 」fastapi 官方网站 ➡💡fastapi 项目构建器. 一款帮助你快速构建 fastapi 项目的工具.fastapi-builder 是一个基于 FastAPI 框架的快速 Web 应用程序开发的工具箱。它提供了一组现成的工具和组件，可以帮助你快速构建具有良好结构和可维护性的 FastAPI Web 应用程序。其目的是提供一个一站式的解决方案，以加速快速原型开发和生产部署。特性TODO快速开始项目结构特别感谢许可证💬 特性参考 Django 化项目基础命令.创建可自定义的 project 项目.创建可定制的 app 应用.为您生成完整的项目结构.对数据库操作进行封装，便于轻松管理.支持数据库包括 Mysql.可选的配置如： Dockerfile、pre-commit.对虚拟环境进行管理.🎯 TODOPS: 期待您对本项目做出贡献...持续完善项目框架代码部分持续完善项目框架文档部分优化 requirements.txt提供英文版本提供项目数据库 PostgreSQL 选项提供完整的 run 方法内置 alembic 数据迁移等管理提供对运行环境的检查提供 fastapi venv 命令，创建/开启/关闭虚拟环境针对 Linux 环境提供支持针对 Mac 环境提供支持生成 app 时，自动注入到 project 中（路由管理分配）🚀 快速开始=> 依赖：Python 3.6+=> 详细教程：tutorial安装fastapi-builder项目：pipinstallfastapi-builder查看项目版本：fastapi--version项目帮助：fastapi--help
fastapistartproject--help创建fastapi项目：fastapistartproject[name]# or 带有交互选择fastapistartproject[name]--interactive创建fastapi应用：fastapistartapp[name]运行fastapi项目：fastapirun通过访问http://127.0.0.1:8000/docs以确保 fastapi 服务正常运行.📁 项目结构.├──alembic/-数据库迁移工具├──api/-web相关（路由、认证、请求、响应）.│├──errors/-定义错误处理方法.││├──http_error.py-http错误处理方法│││──validation_error.py-验证错误处理方法│├──routes/-webroutes路由.││├──api.py-总路由接口││└──authentication.py-认证相关（登录、注册）路由├──app_user/-user应用.│├──api.py-提供user接口方法│├──model.py-提供user表模型│├──schema.py-提供user结构模型├──core/-项目核心配置,如:配置文件,事件句柄,日志.│├──.env-配置文件.│├──config.py-解析配置文件,用于其他文件读取配置.│├──events.py-定义fastapi事件句柄.│├──logger.py-定义项目日志方法.├──db/-数据库相关.│├──base.py-导入所有应用model.│└──database.py-sqlalchemy方法应用.│├──errors.py-数据库相关错误异常.│├──events.py-数据库相关事件句柄.├──lib/-自定义库│├──jwt.py-用户认证jwt方法.│├──security.py-加密相关方法.├──logs/-日志文件目录.├──middleware/-项目中间件.│├──logger.py-请求日志处理.├──models/-sqlalchemy基础模型相关│├──base.py-sqlalchemydeclarativeBase表模型.│└──mixins.py-mixin抽象模型定义.├──schemas/-pydantic结构模型相关.│├──auth.py-用户认证相关结构模型.│└──base.py-pydantic结构模型基础类.│├──jwt.py-jwt相关结构模型.├──utils/-工具类.│├──consts.py-项目常量定义.│├──dbmanager.py-数据库管理服务.│├──docs.py-fastapidocs文档自定义.├──.pre-commit-config.yaml-pre-commit配置文件.├──alembic.ini-alembic数据库迁移工具配置文件.├──docker-compose.yaml-docker配置.├──Dockerfile-dockfile文件.├──.fastapi-builder.ini-fastapi-builder配置文件.├──LICENSE-许可证信息.├──main.py-fastapiapplication创建和配置.├──pyproject.toml-poetry需求模块信息.├──README.md-项目说明文档.├──requirements.txt-pip需求模块信息.└──setup.cfg-pre-commit配置文件.⚡ 特别感谢项目配置生成及 questionary 内容基于项目：https://github.com/ycd/manage-fastapifastapi 项目基础框架参考：https://github.com/nsidnev/fastapi-realworld-example-app/🚩 许可证项目根据麻省理工学院的许可条款授权.
Package: fastapi-cache
FastAPI CacheImplements simple lightweight cache system as dependencies in FastAPI.Installationpipinstallfastapi-cacheUsage examplefromfastapiimportDepends,FastAPIfromfastapi_cacheimportcaches,close_cachesfromfastapi_cache.backends.redisimportCACHE_KEY,RedisCacheBackendapp=FastAPI()defredis_cache():returncaches.get(CACHE_KEY)@app.get('/')asyncdefhello(cache:RedisCacheBackend=Depends(redis_cache)):in_cache=awaitcache.get('some_cached_key')ifnotin_cache:awaitcache.set('some_cached_key','new_value',5)return{'response':in_cacheor'default'}@app.on_event('startup')asyncdefon_startup()->None:rc=RedisCacheBackend('redis://redis')caches.set(CACHE_KEY,rc)@app.on_event('shutdown')asyncdefon_shutdown()->None:awaitclose_caches()TODOAdd testsAdd registry decoratorAdd dependency for requests cachingAcknowledgmentsBalburdiaxobtoorjersobhChangelog0.0.6 Added typings for backends. Specific arguments now need to be passed through **kwargs.
Set default encoding to utf-8 for redis backend, removed default TTL for redis keys.
Package: fastapi-cache2
fastapi-cacheIntroductionfastapi-cacheis a tool to cache fastapi response and function result, with backends supportredis,memcache,
anddynamodb.FeaturesSupportredis,memcache,dynamodb, andin-memorybackends.Easily integration withfastapi.Support http cache likeETagandCache-Control.Requirementsasyncioenvironment.redisif useRedisBackend.memcacheif useMemcacheBackend.aiobotocoreif useDynamoBackend.Install>pipinstallfastapi-cache2or>pipinstall"fastapi-cache2[redis]"or>pipinstall"fastapi-cache2[memcache]"or>pipinstall"fastapi-cache2[dynamodb]"UsageQuick StartfromfastapiimportFastAPIfromstarlette.requestsimportRequestfromstarlette.responsesimportResponsefromfastapi_cacheimportFastAPICachefromfastapi_cache.backends.redisimportRedisBackendfromfastapi_cache.decoratorimportcachefromredisimportasyncioasaioredisapp=FastAPI()@cache()asyncdefget_cache():return1@app.get("/")@cache(expire=60)asyncdefindex():returndict(hello="world")@app.on_event("startup")asyncdefstartup():redis=aioredis.from_url("redis://localhost",encoding="utf8",decode_responses=True)FastAPICache.init(RedisBackend(redis),prefix="fastapi-cache")InitializationFirstly you must callFastAPICache.initon startup event offastapi, there are some global config you can pass in.UsecachedecoratorIf you want cachefastapiresponse transparently, you can usecacheas decorator between router decorator and view
function and must passrequestas param of view function.Parametertype, descriptionexpireint, states a caching time in secondsnamespacestr, namespace to use to store certain cache itemscoderwhich coder to use, e.g. JsonCoderkey_builderwhich key builder to use, default to builtinYou can also usecacheas decorator like other cache tools to cache common function result.Custom coderBy default useJsonCoder, you can write custom coder to encode and decode cache result, just need
inheritfastapi_cache.coder.Coder.@app.get("/")@cache(expire=60,coder=JsonCoder)asyncdefindex():returndict(hello="world")Custom key builderBy default use builtin key builder, if you need, you can override this and pass incacheorFastAPICache.initto
take effect globally.defmy_key_builder(func,namespace:Optional[str]="",request:Request=None,response:Response=None,*args,**kwargs,):prefix=FastAPICache.get_prefix()cache_key=f"{prefix}:{namespace}:{func.__module__}:{func.__name__}:{args}:{kwargs}"returncache_key@app.get("/")@cache(expire=60,coder=JsonCoder,key_builder=my_key_builder)asyncdefindex():returndict(hello="world")InMemoryBackendInMemoryBackendstore cache data in memory and use lazy delete, which mean if you don't access it after cached, it
will not delete automatically.Tests and coveragecoveragerun-mpytest
coveragehtml
xdg-openhtmlcov/index.htmlLicenseThis project is licensed under theApache-2.0License.
Package: fastapi-cachepot
CachepotThe FastAPI cache the way it should be.Installationpipinstallfastapi-cachepotUsageimportredis.asyncioasredisfromcachepot.appimportCachedFastAPIfromcachepot.constantsimportCachePolicyfromcachepot.storagesimportRedisStorageapp=CachedFastAPI()client=redis.from_url('redis://127.0.0.1:6379')storage=RedisStorage(client)cache_policy=CachePolicy(storage=storage,key='cached_hello_world',ttl=30,)@app.get(path='',cache_policy=cache_policy)asyncdefcached_hello_world():return{'result':'hello, world!'}
Package: fastapi-caching
FastAPI-CachingCache library for FastAPI with tag based invalidation. Asynchronous only for the time being.FeaturesAutomatic response cache fetching using FastAPI dependenciesFine-grained control over when to return and set the cacheAbility to invalidate cached objects based on a concept of associated tags. Seeexamples/redis_appfor an example.InstallationWith in-memory support only:pipinstallfastapi-cachingNOTE: In-memory backend is only recommended when your app is only run as a single instance.With redis support (through theaioredislibrary):pipinstallfastapi-caching[redis]Usage examplesExamples on how to usecan be found here.LimitationsOnly supported within async contexts.Changelogv0.1.2, 2020-08-16Feature: Support lazy setup of cache managerv0.2.0, 2020-08-16Breaking change: Revert to requiringbackendto be passed to CacheManagerFeature: Support lazy configuration of the caching backendv0.3.0, 2020-08-16Feature: Add functionality to disable (and re-enable) caching.
Package: fastapi-camelcase
Fastapi CamelcasePackage for providing a class for camelizing request and response bodies for fastapi
while keeping your python code snake cased.Full documentation can be foundhereHow to installpipinstallfastapi-camelcaseDependenciespydantic
pyhumpsHow to use# using CamelModel instead of Pydantic BaseModelfromfastapi_camelcaseimportCamelModelclassUser(CamelModel):first_name:strlast_name:strage:intHow to use (full example)importuvicornfromfastapiimportFastAPIfromfastapi_camelcaseimportCamelModelclassUser(CamelModel):first_name:strlast_name:strage:intapp=FastAPI()@app.get("/user/get",response_model=User)asyncdefget_user():returnUser(first_name="John",last_name="Doe",age=30)@app.post("/user/create",response_model=User)asyncdefcreate_user(user:User):returnuserif__name__=="__main__":uvicorn.run(app,host="0.0.0.0",port=8000)
Package: fastapi-casdoor
fastAPI CasdoorIntegration Casdoor with FastAPIInstallationpipinstallfastapi-casdoorUsagefromtypingimportAnnotated,DependsfromfastapiimportFastAPIfromfastapi_casdoor.depsimportget_current_userfromfastapi_casdoor.modelsimportUser@app.get("/")asyncdefroot(user:Annotated[User,Depends(get_current_user)]):return{"user":user,}
Package: fastapiccache
fastapicachefastapicache is a package that privde simple and fast caching system for the fastapi packageinstallnote for the double C in the namepipinstallfastapiccacheusagefast and simpleimporttimefromfastapiimportFastAPIfromfastapicacheimportfastapicacheapp=FastAPI()@app.get('/')@fastapicache(revalidate=0)asyncdefindex(name:str="unknown"):time.sleep(4)returnf"{name}: hello world"
Package: fastapi-cdn-host
FastAPI CDN host Selector for docs uiAuto find swagger-ui in local files, if exist use them.
Otherwise make concurrent http requests by httpx to find out which third part cdn host is the fastest one.English|中文Installpipinstallfastapi-cdn-hostUsageLet's say that the default docs CDN hosthttps://cdn.jsdelivr.netis too slow in your network, while unpkg.com is much faster.fromfastapiimportFastAPIfromfastapi_cdn_hostimportmonkey_patch_for_docs_uiapp=FastAPI()# include_routes ...monkey_patch_for_docs_ui(app)# Will use `unpkg.com` to replace the `cdn.jsdelivr.net/npm`In case of there are swagger-ui asset files in local directory namedstatic# Will auto mount static, then use `/static/swagger-ui-bundle.js` and `/static/swagger-ui.css` as docs assetsmonkey_patch_for_docs_ui(app)This line is much more simple to serve offline docs then the example in official document:https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/?h=static#self-hosting-javascript-and-css-for-docsIf asset files are ready in private cdn# Will render /docs with the following asset urls:#   http://my-cdn.com/swagger-ui@latest/swagger-ui-bundle.js#   http://my-cdn.com/swagger-ui@latest/swagger-ui.css# render /redoc with: `http://my-cdn.com/redoc/next/redoc.standalone.js`monkey_patch_for_docs_ui(app,docs_cdn_host=('http://my-cdn.com',('/swagger-ui@latest/','/redoc/next/')))LicenseMIT
Package: fastapi-chameleon
fastapi-chameleonAdds integration of the Chameleon template language to FastAPI. If you are interested in Jinja instead, see the sister project:github.com/AGeekInside/fastapi-jinja.InstallationSimplypip install fastapi_chameleon.UsageThis is easy to use. Just create a folder within your web app to hold the templates such as:├── main.py
├── views.py
│
├── templates
│   ├── home
│   │   └── index.pt
│   └── shared
│       └── layout.ptIn the app startup, tell the library about the folder you wish to use:importosfrompathlibimportPathimportfastapi_chameleondev_mode=TrueBASE_DIR=Path(__file__).resolve().parenttemplate_folder=str(BASE_DIR/'templates')fastapi_chameleon.global_init(template_folder,auto_reload=dev_mode)Then just decorate the FastAPI view methods (works on sync and async methods):@router.post('/')@fastapi_chameleon.template('home/index.pt')asyncdefhome_post(request:Request):form=awaitrequest.form()vm=PersonViewModel(**form)returnvm.dict()# {'first':'Michael', 'last':'Kennedy', ...}The view method should return adictto be passed as variables/values to the template.If afastapi.Responseis returned, the template is skipped and the response along with status_code and
other values is directly passed through. This is common for redirects and error responses not meant
for this page template.Friendly 404s and errorsA common technique for user-friendly sites is to use acustom HTML page for 404 responses.
This is especially important in FastAPI because FastAPI returns a 404 response + JSON by default.
This library has support for friendly 404 pages using thefastapi_chameleon.not_found()function.Here's an example:@router.get('/catalog/item/{item_id}')@fastapi_chameleon.template('catalog/item.pt')asyncdefitem(item_id:int):item=service.get_item_by_id(item_id)ifnotitem:fastapi_chameleon.not_found()returnitem.dict()This will render a 404 response with using the template filetemplates/errors/404.pt.
You can specify another template to use for the response, but it's not required.If you need to return errors other thanNot Found(status code404), you can use a more
generic function:fastapi_chameleon.generic_error(template_file: str, status_code: int).
This function will allow you to return different status codes. It's generic, thus you'll have
to pass a path to your error template file as well as a status code you want the user to get
in response. For example:@router.get('/catalog/item/{item_id}')@fastapi_chameleon.template('catalog/item.pt')asyncdefitem(item_id:int):item=service.get_item_by_id(item_id)ifnotitem:fastapi_chameleon.generic_error('errors/unauthorized.pt',fastapi.status.HTTP_401_UNAUTHORIZED)returnitem.dict()
Package: fastapi-chat
UsageSet env variables for chat serviceRunpython run.pyon your server. Chat will be available on endpoint ws://host:port/chatAs soon as you start server there will be connection to redis.
Using chat's endpoint user subscribes to queue, receiving data from it.
Queue's message must be like:{"sender_id": 1, "reciever_ids": [2, 3, 4]}, "message": {"id": 111}}sender_id- required (all messages have sender)reciever_ids- non-required, can be empty list or this field can even not existmessage- non-required, object that will be sent to usersEnv variables*default in ()CHAT_HOST- host for running uvicorn application (0.0.0.0)CHAT_PORT- post for running uvicorn application (8088)CHAT_WORKERS- number of workers for uvicorn application (1)CHAT_BROKER_HOST- host for redis to subscribe to the queue (0.0.0.0)CHAT_BROKER_PORT- port for redis to subscribe to the queue (6300)CHAT_BROKER_DB- db for redis to subscribe to the queue (2)CHAT_CHANNEL_NAME- queue's name to subscribe to (chat)CHAT_DJANGO_BASE_URL- base url of django's application (http://localhost:4114/)CHAT_DJANGO_GET_USER_URL- django's endpoint to get current user's information (api/v1/me)CHAT_DJANGO_TOKEN_TYPE- jwt token's start (Bearer)CHAT_DJANGO_USER_RESPONSE_ID_FIELD- field for getting user's id after request to CHAT_DJANGO_GET_USER_URLwritten using python 3.8.2
Package: fastapi-chat-sdk
UsageSet env variables for chat serviceRunpython run.pyon your server. Chat will be available on endpoint ws://host:port/chatAs soon as you start server there will be connection to redis.
Using chat's endpoint user subscribes to queue, receiving data from it.
Queue's message must be like:{"sender_id": 1, "reciever_ids": [2, 3, 4]}, "message": {"id": 111}}sender_id- required (all messages have sender)reciever_ids- non-required, can be empty list or this field can even not existmessage- non-required, object that will be sent to usersEnv variables*default in ()CHAT_HOST- host for running uvicorn application (0.0.0.0)CHAT_PORT- post for running uvicorn application (8088)CHAT_WORKERS- number of workers for uvicorn application (1)CHAT_BROKER_HOST- host for redis to subscribe to the queue (0.0.0.0)CHAT_BROKER_PORT- port for redis to subscribe to the queue (6300)CHAT_BROKER_DB- db for redis to subscribe to the queue (2)CHAT_CHANNEL_NAME- queue's name to subscribe to (chat)CHAT_DJANGO_BASE_URL- base url of django's application (http://localhost:4114/)CHAT_DJANGO_GET_USER_URL- django's endpoint to get current user's information (api/v1/me)CHAT_DJANGO_TOKEN_TYPE- jwt token's start (Bearer)CHAT_DJANGO_USER_RESPONSE_ID_FIELD- field for getting user's id after request to CHAT_DJANGO_GET_USER_URLwritten using python 3.8.2
Package: fastapi-cli-service
Project generator and manager for FastAPI.Source Code: View it onGithubFeatures 🚀Creates customizableproject boilerplate.Creates customizableapp boilerplate.Handles the project structuring for you.Optional Dockerfile generation.Optional docker-compose generation for your project needs.Optional pre-commit hook generation.Installation 📌PrerequisitesPython 3.6 +Manage FastAPI can be installed by runningpip3installgit+https://github.com/sxhxliang/fastapi-cli# orgitclonehttps://github.com/sxhxliang/fastapi-clicdfastapi-cli&&python3setup.pydevelopGetting started 🎈Easiest way to start is using the defaults:fastapistartproject[name]But there is aninteractivemode!fastapistartproject[name]--interactiveCommand line options 🧰Manage FastAPI provides three different commands.You can list them withfastapi--helpThe idea is to have a highly customizable CLI, but at the same time a simple interface for new users. You can see the available options forstartprojectrunningfastapi startproject --help:The other commands are already available but the current implementation is too shallow. More details aboutstartappandruncommands will be provided once they have more functionalities, at the moment you can runstartappby just:fastapistartapp{name}On the other hand, theruncommand expects you to have astartprojectstructure:fastapirunLicenseThis project is licensed under the terms of the MIT license.
Package: fastapi-cloud-drives
FastAPI Cloud Drives🧐 AboutThe FastAPI Cloud Drives module supports Google Drive, OneDrive, Dropbox cloud storage providers. You can easily search, upload, download files from this cloud providers.🏁 Getting Started🔨 Installingpoetryaddfastapi-cloud-drives💻 UsageFor using fastapi-google-drive use link belowFastAPI Google DriveSee also the list ofcontributorswho participated in this project.👀 ContributingWe are open to  new ideas, additions. If you have any we would be happy to recieve and diccuss.
Package: fastapi-cloud-logging
fastapi-cloud-loggingProject descriptionfastapi-cloud-logging improves cloud logging with fastapi. It enables to send request data on cloud logging.Dependenciesfastapicloud loggingPython >= 3.7RequirecontextvarsInstallationpipinstallfastapi-cloud-loggingUsageAdd a middleware and set a handler to send a request info with each logging.fromfastapiimportFastAPIfromgoogle.cloud.loggingimportClientfromgoogle.cloud.logging_v2.handlersimportsetup_loggingfromfastapi_cloud_loggingimportFastAPILoggingHandler,RequestLoggingMiddlewareapp=FastAPI()# Add middlewareapp.add_middleware(RequestLoggingMiddleware)# Use manual handlerhandler=FastAPILoggingHandler(Client())setup_logging(handler)OptionalStructured MessageCloud logging supports log entries with structured and unstructured data.
When a log record has a structured data, it write a log entry with structured data. And when a log record contains a string message, it write a log entry as an unstructured textPayload attribute.When this structured option set True on FastAPILoggingHandler, it always write a log entry with a message attribute on a structured jsonPayload object.# default structured value is Falsehandler=FastAPILoggingHandler(Client(),structured=True)Error traceOn logging with an error, message payloads includes traceback from an error.
If you do not want to include traceback, you should set traceback_length to 0.# default traceback_length is 100handler=FastAPILoggingHandler(Client(),traceback_length=0)ChangelogCHANGELOG.mdAppendixWith multithreadingThis middleware depends mainly contextvars. So, when you use multithreading, it cannot handle a request info. On this case, you write a code for manual context management. For example, usecopy_contexton a thread.For more information, please reada great article about contextvars.
Package: fastapi-cls
Examplefastapi_cls demoCreate a fileview.pywith:frompydanticimportBaseModelfromfastapiimportDependsclassUser(BaseModel):username:stremail:Optional[str]=Nonefull_name:Optional[str]=Nonedisabled:Optional[bool]=Noneasyncdefget_user():returnUser(username="john")classItemView:user:User=Depends(get_user)defget(self)->User:returnself.userdefpost(self)->str:self.user.username='change name'return"ok"Create a fileroute.pywith:fromfastapi_clsimportClassRouterrouter=ClassRouter()router.add_resource("/item",ItemView,methods=["GET","POST"])Or, if you want to define your owner method reflect to http method. you can do like this.fromfastapi_clsimportClassRouterrouter=ClassRouter()router.add_method_route("/item",ItemView,ItemView.get,methods=["GET"])router.add_method_route("/item",ItemView,ItemView.post,methods=["POST"])Its equivalent tofastapifromfastapiimportApiRouter,DependsclassUser(BaseModel):username:stremail:Optional[str]=Nonefull_name:Optional[str]=Nonedisabled:Optional[bool]=Noneasyncdefget_user():returnUser(username="john")router=ApiRouter()@router.get('/item')defget(user:User=Depends(get_user))->User:returnuser@router.post('/item')defpost(user:User=Depends(get_user))->str:user.username='change name'return"ok"In this case. TheItemViewmethodsgetandpostwill bind on router as a function.
Package: fastapi-cls-controller
A decorator based router for FastAPI# fruit_controller.pyfromfastapi_cls_controllerimportcontroller,delete,get,post,put,...@controller(prefix="/fruits",)classFruitController:@post("")asyncdefcreate(self,body:CreateFruit):...@get("/{fruit_id}")asyncdefget(self,fruit_id:str):...# main.pyapp.include_router(FruitController())
Package: fastapi-cognito-security
fastapi-cognito-securityA micro-library that implements aFastAPI securityclass forAWS Cognitosecurity.This library supports receiving the Cogntio access (recommended) or id token in the HTTPAuthorizationheader using the standardBearermechansism (e.g. -Authorization: Bearer <token>).Installationpipinstallfastapi-cognito-securityUsageSecuring an individual routefromfastapiimportDepends,FastAPIfromfastapi_cognito_securityimportCognitoBearerapp=FastAPI()auth=CognitoBearer(app_client_id="my_app_client_id",userpool_id="my_userpool_id")@app.get("/",dependencies=[Depends(auth)])asyncdefroot():return{"message":"Hello World"}Securing a whole apifromfastapiimportDepends,FastAPIfromfastapi_cognito_securityimportCognitoBearerauth=CognitoBearer(app_client_id="my_app_client_id",userpool_id="my_userpool_id")app=FastAPI(dependencies=[Depends(auth)])@app.get("/")asyncdefroot():return{"message":"Hello World"}When called, theCognitoBearerobject will:Get the public keys from your AWS Cognito UserPool.NOTE - this will only happen once, and will be cached thereafter.Validate the JWT by verifying:The JWT is correctly constructed and conforms to the public key.The JWT has not expired.Theclient_id(access token) oraud(id token) matches theapp_client_id.Return either afastapi_cognito_security.AccessTokenorfastapi_cognito_security.IdTokenthat contains the claims.NOTE - you can use these claims for further verification either within your API or by subclassingCognitoBearer.Any failure in the above steps will result in afastapi.HTTPExceptionbeing raised.ClaimsThe returnedAccessTokenorIdTokenwill have the standard Cognito claims converted to Python types.AccessTokenandIdTokenClaimPython Typeauth_timedatetime.datetimeexpdatetime.datetimeiatdatetime.datetimeisspydantic.HttpUrljtiuuid.UUIDorigin_jtiuuid.UUIDsubuuid.UUIDUsername (usernamein access tokens andcognito:usernamein id tokens) is canonicalized to the claimusername.All additional claims will be converted directly to basic Python types.All claim names will have:replaced with_(e.g. -custom:thingwill becomecustom_thing)AccessTokenonlyClaimPython Typedevice_keyuuid.UUIDscopelist[str]Swagger/OpenAPI 3.0 SupportBecauseCognitoBeareris afastapi.HTTPBearer, it will operate in the docs that are auotmatically
generated by FastAPI in the same way as it's parent class.