This project implements a RESTful API using FastAPI for generating and retrieving reports asynchronously. The API allows users to trigger the generation of a report, which runs in the background, and then retrieve the report once it's completed.
- FastAPI: A high-performance web framework for building APIs with Python.
- Uvicorn: An ASGI server for running Python web applications.
- UUID: Used for generating unique report IDs.
Clone the repository:
git clone https://github.com/[your-username]/[your-repository-name].gitInstall the Required Packages:
pip install -r requirements.txtRun the application
uvicorn main:app --reloadThis will start the server on localhost:8000
- Endpoint: POST/report
- Description: This endpoint triggers the generation of a new report in the background and returns a JSON response containing the unique report ID.
- Response:
-
{ "report_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef" }
- Endpoint: GET/report?report_id={report_id}
- Description:This endpoint retrieves the status or the generated report based on the provided report ID.