Skip to main content

A library to use postman collection V2 in python. Inspired by Bardia Heydari nejad

Project description


Postpy2 is a library for Postman that run Postman's collections. Originaly was forked from and updated to Postman collection v2.1 format. If you are using postman, but collection runner is not flexible enough for you and postman codegen is too boring, Postpy2 is here for your continuous integration.

Why use Postpy2 instead of postman codegen?

  • Postman codegen should be applied one by one for each request and it's boring when your API changes, but with Postpy2, you don't need to generate code. Just export collection with Postman and use it with Postpy2.
  • In code generation, you don't have environment feature anymore and variables are hard coded.

Why user Postpy2 instead of Postman collection runner?

  • With Postpy2, you write your own script. But collection runner just turns all your requests one by one. So with Postpy2, you can design more complex test suites.

How to install?

Postpy2 is available on PyPI and you can install it using pip:

$ pip install Postpy2

How to use?

Import Postpy2

from Postpy2.core import Postpy2

Make an instance from Postpy2 and give the address of postman collection file.

runner = Postpy2('/path/to/collection/Postman echo.postman_collection')

Now you can call your request. Folders' name change to upper camel case and requests' name change to lowercase form. In this example the name of folder is "Request Methods" and it's change to RequestMethods and the name of request was "GET Request" and it's change to get_request. So you should call a function like runner.YourFolderName.you_request_name()

response = runner.RequestMethods.get_request()

Variable assignment

In Postpy2 you can assign values to environment variables in runtime.

runner.environments.update({'BASE_URL': ''})
runner.environments.update({'PASSWORD': 'test', 'EMAIL': ''})


Since RequestMethods and get_request does not really exists your intelligent IDE cannot help you. So Postpy2 tries to correct your mistakes. If you spell a function or folder wrong it will suggest you the closest name.

>>> response = runner.RequestMethods.get_requasts()

Traceback (most recent call last):
  File "", line 11, in <module>
    response = runner.RequestMethods.get_requasts()
  File "/usr/local/lib/python3.5/site-packages/Postpy2/", line 73, in __getattr__
    'Did you mean %s' % (item,, similar))
AttributeError: get_requasts request does not exist in RequestMethods folder.
Did you mean get_request

You can also use help() method to print all available requests.

Posible requests:



Feel free to share your ideas or any problems in issues. Contributions are welcomed. Give Postpy2 a star to encourage me to continue its development.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for postpy2, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size postpy2-0.0.1-py3-none-any.whl (17.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size postpy2-0.0.1.tar.gz (4.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page