Fast-Man
Fast-Man is a project that aims to automate the creation of postman_collection.json for a FastAPI app. This tool simplifies the process of generating Postman collections, making it easier to test and document your FastAPI APIs.
Table of Contents
- Features
- Installation
- Usage
- Example
- Project Structure
- License
- Contributing
- Contact
- Funding
- Acknowledgements
Features
- Automated Postman Collection Generation: Automatically generate a Postman collection from your FastAPI app.
- Customizable Output: Specify the output file name, collection name, and host URL.
- Bearer Token Authentication: Supports bearer token authentication for secure API testing.
- Detailed Route Information: Includes request headers, body, parameters, and responses in the generated collection.
Installation
You can install fast-man using pip:
pip install fast-man
Usage
To generate a Postman collection, use the fast-man command-line tool. You need to provide the path to your FastAPI app, and you can optionally specify the output file, collection name, and host URL.
fast-man --app core.main:app \
--output postman_collection.json \
--name "test-api" \
--host "http://test.com:8000/api/v1" \
--readme "README.md"
Using Command-Line Arguments
--app: The path to the FastAPI app instance (required).--output: The output file name for the Postman collection (default:postman_collection.json).--name: The name of the Postman collection (default:API Collection).--host: The host URL for the API (default:http://localhost).--readme: The path to the README.md file (default:README.md).
Note: If you want a custom documentation to be displayed in the Postman collection other than your project's README.md, you can use the
--readmeflag.
Using in a Script
You can also use fast-man directly in your Python code. Here is an example:
from fast_man.converter import generate_postman_collection
from fastapi import FastAPI
app = FastAPI()
@app.get("/items/{item_id}")
async def read_item(item_id: int):
return {"item_id": item_id}
@app.post("/items/")
async def create_item(name: str):
return {"name": name}
generate_postman_collection(
app=app,
output_file='postman_collection.json',
input_name='test-api',
input_host='http://localhost:8000',
readme_file='README.md'
)
print("Postman collection generated successfully.")
Example
Here is an example of how to use fast-man.
Given the project structure:
my-project/
├── core/
│ ├── main.py
├── tests/
│ ├── test_main.py
├── README.md
You can generate the Postman collection using the following command at root:
pip install fast-man
export PYTHONPATH=$(pwd)
fast-man --app core.main:app --output postman_collection.json --name "test-api" --host "http://test.com:8000/api/v1" --readme "README.md"
Project Structure
The project is structured as follows:
fast_man/: Contains the main code for thefast-mantool.__init__.py: Initializes the package.converter.py: Contains the logic for generating the Postman collection.utils.py: Utility functions used by the converter.
tests/: Contains tests for thefast-mantool.test_converter.py: Tests for the converter module.
setup.py: Setup script for packaging the project.LICENSE: License file for the project..gitignore: Git ignore file to exclude unnecessary files from version control.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributing
Contributions are welcomed! Please open an issue or submit a pull request on GitHub; or just get in contact.
Contact
For any questions or issues, please contact Renzo Franceschini at [rennf93@gmail.com].
Funding
If you find this project useful, please consider supporting its development by making a donation. Your support is greatly appreciated!
Acknowledgements
Special thanks to the FastAPI and Pydantic communities for their excellent libraries and documentation.
Metadata
Release files for fast-man 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fast-man-0.1.9.tar.gz | 9.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fast_man-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.2 kB
Release files / fast-man-0.1.9.tar.gz
| Download URL | fast-man-0.1.9.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e669deea9bd6aef09df762576bd71c69b2359b65f51a9a8c57d09e4a01c174d
|
|
BLAKE2b-256 checksum How to use checksums |
a57dd7912309cbace0710281804d59e98250749a206aa6c0d248840347448a29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.14
|
Release files / fast_man-0.1.9-py3-none-any.whl
| Download URL | fast_man-0.1.9-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7a65ce168b15a36e62b86afa914fbf7da42d4e3db7df09125bd2021a224bbed
|
|
BLAKE2b-256 checksum How to use checksums |
44bb29d565996bcf3543a498129835f3965faa71dc9c628c973ec3ad1f46fb56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.14
|
Security for fast-man 0.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.