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.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

fastapi_extended_query_method-0.0.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.3.tar.gz
Algorithm Hash digest
SHA256 0b08bb4d6a68e4f5f5f85e86577e78b07340cb640413d3d870c846a7992d6690
MD5 ac13ed0ead451025f3586c92f96ba787
BLAKE2b-256 70d01ce7f80f58755531f0eb61ab17eaa608e322a5b7b9623876d395a1f3e0d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f523fc3364d9e07953f9d9d92addbeb5e45eb9098c8d820288720f71aac321d6
MD5 ab228fd9e96812372f01ff165ccbd940
BLAKE2b-256 1ee194e1b6f720aacc02756db50a9eb4a97d5c28a8da31bad6d7252b4784efb4

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