postman2py
postman2py is a library for Postman that run Postman's collections.
Originaly was forked from https://github.com/k3rn3l-p4n1c/postpython and https://github.com/matkapi/postpy2 Added few updates related to Postman collection import and urlencoded request type.
Why use postman2py instead of postman codegen?
- No hardcoded variables
- If your team use postman collection for testing and you want to extend testing by integrating some calculation or etc.
How to install?
postman2py is available on PyPI and you can install it using pip:
$ pip install postman2py
How to use?
Import postman2py
from postman2py.core import PostPython
runner = postman2py('/path/to/collection/postman_collection.json')
# runner.default.<request_name> # if no folders in collection
# runner.<folder_name>.<request_name> # if folders exist in collection
response = runner.default.get_request()
print(response.json())
print(response.status_code)
Load enviroment variables
In postman2py you can load enviroment variables from postman enviroment files
pp.environments.load('environments/postman_environment.json')
Set environment variable
runner.environments.update({'BASE_URL': 'http://127.0.0.1:5000'})
runner.environments.update({'PASSWORD': 'test', 'EMAIL': 'you@email.com'})
AttributeError
postman2py try to correct your mistake 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 "test.py", line 11, in <module>
response = runner.RequestMethods.get_requasts()
File "/usr/local/lib/python3.5/site-packages/postman2py/core.py", line 73, in **getattr**
'Did you mean %s' % (item, self.name, 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.
>>> runner.help()
>>> Posible requests:
>>> runner.AuthOthers.hawk_auth()
>>> runner.AuthOthers.basic_auth()
>>> runner.AuthOthers.oauth1_0_verify_signature()
>>> runner.RequestMethods.get_request()
>>> runner.RequestMethods.put_request()
>>> runner.RequestMethods.delete_request()
>>> runner.RequestMethods.post_request()
>>> runner.RequestMethods.patch_request()
or
>>> runner.RequestMethods.help()
>>> runner.RequestMethods.delete_request()
>>> runner.RequestMethods.patch_request()
>>> runner.RequestMethods.get_request()
>>> runner.RequestMethods.put_request()
>>> runner.RequestMethods.post_request()
Metadata
Release files for postman2py 0.0.2
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 | Actions |
|---|---|---|---|---|
| postman2py-0.0.2.tar.gz | 5.2 kB | Without provenance | Details for postman2py-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| postman2py-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for postman2py-0.0.2-py3-none-any.whl |
Total release size: 22.9 kB
Release files / postman2py-0.0.2.tar.gz
| Download URL | postman2py-0.0.2.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db0d74db94e88647f889634583c673d1b24ca840ed3391d9bbd23396d33b5b44
|
|
BLAKE2b-256 checksum How to use checksums |
6cd5a6d5de25465cf0d09b8a5c10b99b5ac77aea2be099c6209454d44c3a1e8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
|
Release files / postman2py-0.0.2-py3-none-any.whl
| Download URL | postman2py-0.0.2-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
960d7701f802d3b3a6395bdc103c0ade48684911a4cadea3e6053354c04f6f5c
|
|
BLAKE2b-256 checksum How to use checksums |
14710fc3a076fe0f5241a01f20addd3e67b2e954bbd0a587cb485adfd395b057
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
|
Security for postman2py 0.0.2
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.