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 src.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.31.tar.gz (4.7 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.31.tar.gz.

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.31.tar.gz
Algorithm Hash digest
SHA256 3fde4160143d3a66785645f6caf8a3594923d73731114b773f55a172fcaa7cfe
MD5 1f957f8ee0cfc28cc18aaa7fe13ce5f0
BLAKE2b-256 f10e3d5f30821dc7667a45dd5d4b6718533182601c2f2897d3f7099f38851c36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.31-py3-none-any.whl
Algorithm Hash digest
SHA256 17995753f0c772b8e7d3077276b5809df18eea6b937be0e6ed84a90d99fcbf5b
MD5 6c471e02f6bd567234f70d808be285a2
BLAKE2b-256 9667dff4e3bc24836a2ce9ebd279ebb8480d7da4bc4ecb374d7030db8bb07d0d

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