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.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.tar.gz.

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.32.tar.gz
Algorithm Hash digest
SHA256 0c9fb5a9d60093df43a0035b4e0b20882f611fe397a45fb3eaa7df4380bc361f
MD5 591fc1821d8572e8e650226a0d644b66
BLAKE2b-256 68c4f24b0d0a0d7311ca3f0da04f226377218cf4f6037752ad8a069ab1fd0009

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.32-py3-none-any.whl
Algorithm Hash digest
SHA256 4227937b667407dd82a3208c511ebe6fa801e13b84484bf1b7f27472a930b29e
MD5 456e5b6da41a722832aff20d91d79e1d
BLAKE2b-256 568a201f479fa0a82693271507d3151e3588e559fb6352af38bd670aabc08758

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