Skip to main content

III Common FastAPI base.

Project description

III API base

Branding

Hatch project Package version PyPI - Python Version
Downloads Weekly downloads Monthly downloads

III FastAPI Common base
Go to pypi now


Usage

Config

The later config will override the previous one.

This table shows the predefined environment variables.

Keyword Type Default Description
DEBUG boolean false To set the logging as DEBUG state.
RELOAD boolean false To auto reload the FastAPI application.
APP_NAME string Backend API The application name shows on Swagger.
from pathlib import Path

from api_helper.config import load_config

# Load config
load_config(Path(__file__).parent / ".env")

# Load default config in the directory (.env)
load_config(Path(__file__).parent)

FastAPI example

To config the FastAPI by env, read the Config section.

from pathlib import Path

from api_helper import FastAPI, success_response

app: FastAPI = FastAPI(base_folder=Path(__file__).parent)
# Optional to setup sentry
app.setup_sentry("sentry_dsn")


@app.get("/")
def home():
    return success_response("Hello, World!")


# Start the app and enjoy
app.run("127.0.0.1", 5000)

Build backend

hatch

hatch env create
hatch build
hatch publish -r test

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iii_api_helper-0.0.9.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iii_api_helper-0.0.9-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file iii_api_helper-0.0.9.tar.gz.

File metadata

  • Download URL: iii_api_helper-0.0.9.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for iii_api_helper-0.0.9.tar.gz
Algorithm Hash digest
SHA256 40cd3a0e1240d362475cc4f93d8bdd48752549d44b5f8ee30eb27130491d1b35
MD5 f06a9f53aba8d46ac81caef20d6dbc52
BLAKE2b-256 df39db373f60207c61e8415caed9d0d292767f5c23097ed67d6dd7bd7cf9a6f5

See more details on using hashes here.

File details

Details for the file iii_api_helper-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for iii_api_helper-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 4809690947c9a16bc22336d2c80f7542369ca487f93c535a20d7dacaab87e4f4
MD5 ab880b1103802a4f009ca266c72b77bb
BLAKE2b-256 7dad42ebdd6fa90099cda53382b46fbc1c94b6fc98471d2f8e89adffb8ffc68c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page