Skip to main content

Native HTTP QUERY method support for FastAPI with automatic cache control and Swagger compatibility.

Project description

FastAPI Extended Query Method

Native HTTP QUERY support for FastAPI.

Overview

FastAPIWithQueryHttpMethod extends FastAPI with native support for the HTTP QUERY method while preserving the FastAPI developer experience.

Installation

pip install fastapi-extended-query-method

Quick Start

from fastapi_extended_query_method import FastAPIWithQueryHttpMethod

app = FastAPIWithQueryHttpMethod(query_saving_cache=True)

Swagger compatibility

After starting the application:

http://localhost:8000/docs

OpenAPI and Swagger do not currently support the HTTP QUERY method.

For that reason this package automatically exposes QUERY endpoints as both:

  • QUERY
  • POST

Use the POST operation in Swagger only for interactive testing.

Real clients should invoke the QUERY method directly.

Swagger Interface

Cache

query_saving_cache=True allows caching.

query_saving_cache=False automatically adds:

  • Cache-Control: no-store
  • Pragma: no-cache
  • Expires: 0

Testing API

python validate_data/test_api_query_method.py

API Results

Testing Cache

Using Cache Stored

python validate_data/test_cache_comparison.py

Stored Cache

NO Using Cache Stored

Without Cache

License

MIT

Project details


Download files

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

Source Distribution

fastapi_extended_query_method-0.0.32.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file fastapi_extended_query_method-0.0.32.1.tar.gz.

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.32.1.tar.gz
Algorithm Hash digest
SHA256 722581ad3752b25e38462e8b25f9c6f4ad7a3e291e6b2279ed5760d600440e2c
MD5 b73417e33c0c153dcedd5ddeb92da732
BLAKE2b-256 538c0f04a813468a1077e22da5b401f9f9ad4b79ac04d30db7d2e3743098c23a

See more details on using hashes here.

File details

Details for the file fastapi_extended_query_method-0.0.32.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.32.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca543ea9767ccd7ca3ffd34ad2b6351145324613bbf097db0d2dc7777fb21a89
MD5 906ff304c732beb6a1d72a6309fd5917
BLAKE2b-256 fb5d96791f02e59384a756098d1cff09b2d11f3512925d2d0f13518e3c210ecc

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