Skip to main content

A FastAPI debug tool to look into request/response

Project description

FastAPI X-ray 🔥

This TUI is designed to streamline the debugging process by providing a comprehensive view of request/response data and tracking all executed SQL queries. This tool empowers developers to effectively diagnose and resolve issues related to database interactions.

Key Features:

  • Request/Response Data Debugging: Gain deep insights into the data exchanged between client applications and the server. Easily identify and analyze the content and structure of both incoming requests and outgoing responses.

  • SQL Query Tracking: Track every SQL query executed during the application runtime. Monitor query performance, detect bottlenecks, and optimize database interactions for enhanced efficiency.

Screenshots

image

image

Installation

Install this package from pypi using this command.

pip install fastapi-xray

Usage

It is very easy to use. Call the start_xray function to start intercepting all the request and response.

from fastapi import FastAPI
from sqlalchemy import create_engine

from fastapi_xray import start_xray

# create SQLAlchemy engine
engine = create_engine("sqlite:///app.db")

app = FastAPI()

# Pass the instance of app and sql engine to the function.
# Passing the sql engine instance is optional
# if you are not using any database.
# NOTE: Not recommended to use it in the production.

if os.environ["DEBUG"]:
    start_xray(app, engine)

Start the CLI to see the incoming requests in the terminal. Use this command to start the terminal interface.

fastapi_xray # starts the xray server at 8989 port

Use the --help command to see all the configurable options.

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_xray-0.1.1.tar.gz (11.7 kB view hashes)

Uploaded Source

Built Distribution

fastapi_xray-0.1.1-py3-none-any.whl (15.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page