:rocket: Generate a Postman collection from your Flask application

Overview

flask2postman


A tool that creates a Postman collection from a Flask application.

Install

$ pip install flask2postman

Example

Let's say that you have a Flask project called "example" (see example.py), and you want to generate a Postman collection out of it.

You just need to tell flask2postman how to import the Flask instance, and optionally give a name to the Postman collection:

$ flask2postman example.app --name "Example Collection" --folders > example.json

If you don't have a global Flask instance but rather use a function to initialize your application, that works too:

$ flask2postman example.create_app --name "Example Collection" --folders > example.json

This will generate the JSON configuration, and write it into the example.json file. You can then import this file into Postman ("Import Collection" button), and profit:

Postman screenshot

On a side note, you can see that endpoint's docstrings are automatically imported as descriptions.

Usage

usage: flask2postman [-h] [-n NAME] [-b BASE_URL] [-a] [-i] [-f]
                     flask_instance

positional arguments:
  flask_instance

optional arguments:
  -h, --help            show this help message and exit
  -n NAME, --name NAME  Postman collection name (default: current directory
                        name)
  -b BASE_URL, --base_url BASE_URL
                        the base of every URL (default: {{base_url}})
  -a, --all             also generate OPTIONS/HEAD methods
  -s, --static          also generate /static/{{filename}} (Flask internal)
  -i, --indent          indent the output
  -f, --folders         add Postman folders for blueprints

License

MIT

Comments
  • URL Segment Params

    URL Segment Params

    It could be nice to have a way to generate URL segment variables instead of global variables. It would be useful when you use common global variables between different collections but want some variables to be unique to some endpoints.

    URL segment variables are defined using semi-colon {{host}}/endpoint/:url_var/:another_url_var. I saw it referenced in that issue. :chicken:

    enhancement help wanted 
    opened by hilkins 2
  • docs: fix simple typo, contaning -> containing

    docs: fix simple typo, contaning -> containing

    There is a small typo in example.py.

    Should read containing rather than contaning.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 1
  • Insert the current directory at beginning of python path

    Insert the current directory at beginning of python path

    Hi,

    I investigated a bit about #4 and found out that inserting the current directory at the beginning of the python path instead of the end solve the issue.

    Cheers,

    opened by Shir0kamii 1
  • Bad instance used in a virtualenv

    Bad instance used in a virtualenv

    In a virtualenv, if the instance parameter is a valid import in a directory in .venv/src/, it will use that import rather than the expected import.

    For exemple, if I have a file called "run.py" in my project directory (so project/run.py) and that project/.venv/src/random_lib/run.py exists, flask2postman run.app will try to import app from project/.venv/src/random_lib/run.py rather than from project/run.py.

    I have no idea why this is happening, I need to investigate more.

    bug help wanted confirmed 
    opened by ramnes 1
  • Py3 fix, Folder per Blueprint, new Arg, Version to 1.2.0

    Py3 fix, Folder per Blueprint, new Arg, Version to 1.2.0

    Py3 - issue fixed, caused by deprecated (read removed) sys.maxint and lack of testing on Py3. Folder per Blueprint - For every blueprint there will be a folder made in postman if -f / --folders argument is present.

    ps. also change license in setup.py to MIT.

    opened by zet4 1
  • Support Postman Collection Format v2

    Support Postman Collection Format v2

    This pull requests adds support for Postman Collection Format v2.1.0. This change has been asked for in issue #9. The schema of this collection format can be found here: https://schema.getpostman.com/collection/json/v2.1.0/draft-07/docs/index.html

    The default output format now is v2.1.0. I added an argument which lets the user export using v1:

    flask2postman example.app --name "Example Collection" -v1 -i > example.json

    opened by LucasHild 2
Owner
Numberly
Marketing Technologist — Omnichannel. Programmatic. Conversational.
Numberly
Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

Max Countryman 310 Dec 14, 2022
Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

Max Countryman 282 Feb 11, 2021
Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development.

Flask-Starter Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development. It has all the r

Kundan Singh 259 Dec 26, 2022
Brandnew-flask is a CLI tool used to generate a powerful and mordern flask-app that supports the production environment.

Brandnew-flask is still in the initial stage and needs to be updated and improved continuously. Everyone is welcome to maintain and improve this CLI.

brandonye 4 Jul 17, 2022
Flask-app scaffold, generate flask restful backend

Flask-app scaffold, generate flask restful backend

jacksmile 1 Nov 24, 2021
flask-apispec MIT flask-apispec (🥉24 · ⭐ 520) - Build and document REST APIs with Flask and apispec. MIT

flask-apispec flask-apispec is a lightweight tool for building REST APIs in Flask. flask-apispec uses webargs for request parsing, marshmallow for res

Joshua Carp 617 Dec 30, 2022
flask-reactize is a boostrap to serve any React JS application via a Python back-end, using Flask as web framework.

flask-reactize Purpose Developing a ReactJS application requires to use nodejs as back end server. What if you want to consume external APIs: how are

Julien Chomarat 4 Jan 11, 2022
Adds GraphQL support to your Flask application.

Flask-GraphQL Adds GraphQL support to your Flask application. Usage Just use the GraphQLView view from flask_graphql from flask import Flask from flas

GraphQL Python 1.3k Jan 3, 2023
Adds GraphQL support to your Flask application.

Flask-GraphQL Adds GraphQL support to your Flask application. Usage Just use the GraphQLView view from flask_graphql from flask import Flask from flas

GraphQL Python 1.2k Feb 17, 2021
iloveflask is a Python library to collect functions that help a flask developer generate reports, config files and repeat code.

I Love Flask iloveflask is a Python library to collect functions that help a flask developer generate reports, config files and repeat code. Installat

null 2 Dec 29, 2021
A web application that consists of a collection of board games

PyBoardGame About This website contains a collection of board games for users to enjoy, as well as various guides for the games. The web app is built

Larry Shi 0 Aug 11, 2021
Seamlessly serve your static assets of your Flask app from Amazon S3

flask-s3 Seamlessly serve the static assets of your Flask app from Amazon S3. Maintainers Flask-S3 is maintained by @e-dard, @eriktaubeneck and @SunDw

Edd Robinson 188 Aug 24, 2022
Flask-Rebar combines flask, marshmallow, and swagger for robust REST services.

Flask-Rebar Flask-Rebar combines flask, marshmallow, and swagger for robust REST services. Features Request and Response Validation - Flask-Rebar reli

PlanGrid 223 Dec 19, 2022
Flask Project Template A full feature Flask project template.

Flask Project Template A full feature Flask project template. See also Python-Project-Template for a lean, low dependency Python app. HOW TO USE THIS

Bruno Rocha 96 Dec 23, 2022
A Fast API style support for Flask. Gives you MyPy types with the flexibility of flask

Flask-Fastx Flask-Fastx is a Fast API style support for Flask. It Gives you MyPy types with the flexibility of flask. Compatibility Flask-Fastx requir

Tactful.ai 18 Nov 26, 2022
Flask pre-setup architecture. This can be used in any flask project for a faster and better project code structure.

Flask pre-setup architecture. This can be used in any flask project for a faster and better project code structure. All the required libraries are already installed easily to use in any big project.

Ajay kumar sharma 5 Jun 14, 2022
Pf-flask-rest-com - Flask REST API Common Implementation by Problem Fighter Library

In the name of God, the Most Gracious, the Most Merciful. PF-Flask-Rest-Com Docu

Problem Fighter 3 Jan 15, 2022
Flask-Discord-Bot-Dashboard - A simple discord Bot dashboard created in Flask Python

Flask-Discord-Bot-Dashboard A simple discord Bot dashboard created in Flask Pyth

Ethan 8 Dec 22, 2022
Open-source Flask Sample built on top of flask-dance library

Open-source Flask Sample built on top of flask-dance library. The project implements the social login for Github and Twitter - Originally coded by TestDriven.IO.

App Generator 4 Jul 26, 2022