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.3.31.tar.gz (8.2 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.3.31.tar.gz.

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.3.31.tar.gz
Algorithm Hash digest
SHA256 82b8330c4d842b45c37eeff57f9b10d3f5bdfb17d48303eb9f9f4bc02661a342
MD5 f45737415a9fafeea226ab73674b4588
BLAKE2b-256 7ce4885342b3d381a7730747e7f12f437d57f9e14ab5ed0977748b3e5f88cf84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.3.31-py3-none-any.whl
Algorithm Hash digest
SHA256 644cef868a21182210a57d1a930d07542ff2aee9b6cee8aef101b7bf2b42083e
MD5 c5ef75e8fd71e98ca4196085f1010a58
BLAKE2b-256 2849a5d2e457c72df1361c689ad885bdcea1da9970c82901e39683b0b3927725

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