Pydantic Settings with AWS Secrets Manager

Intro If you are already familiar with Pydantic, one of the useful components of Pydantic is the Settings Management. This will allow you to read settings variables from different sources and parse and validate them into class(es) using Pydantic. Let’s see a minimal example. First we need to set up the variable: $ export API_KEY=xxx And then we can read it into the Settings class with: from pydantic import BaseSettings class Settings(BaseSettings): api_key: str print(Settings()....

January 26, 2023 · 5 min · 1002 words · Amin