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

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.31.213.tar.gz
Algorithm Hash digest
SHA256 ae26e6d11fa134e342b0c41a5d17cd74bcca68414424dfecd2c76dc4467a3c6c
MD5 4ece5e08584dfaab0766644c409da487
BLAKE2b-256 d04c660b2cc8488fdab566041953462d883634618619c44263cf4e41b8d513d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_extended_query_method-0.0.31.213-py3-none-any.whl
Algorithm Hash digest
SHA256 b22703dd591e8f50095e7c071224e9a6f0bae072dae8d1496b00407e4e05cf85
MD5 fecd954f7015148009a76703f6e2dfd5
BLAKE2b-256 77dae7b1cec257aee880cf75d3944d21deea073b460b93d6e3e5a96e0402cd34

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