Skip to main content

PostPyGraphQL

PostPyGraphQL is a library for Postman that run Postman's collections. Originally was forked from https://github.com/matkapi/postpy2 and updated for using body mode GraphQL. If you are using postman, but collection runner is not flexible enough for you and postman codegen is too boring, PostPyGraphQL is here for your continuous integration.

Why use PostPyGraphQL 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 PostPyGraphQL, you don't need to generate code. Just export collection with Postman and use it with PostPyGraphQL.
  • In code generation, you don't have environment feature anymore and variables are hard coded.

Why use PostPyGraphQL instead of Postman collection runner?

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

Why use PostPyGraphQL with GraphQL collections?

The framework contains necessary functionality to run GraphQL methods from Postman collections. It's also available to change GraphQL variables directly from tests using dict of new GraphQL variables as an argument in a method.

How to install?

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

$ pip install postpygraphql

How to use?

Import postpygraphql

from postpygraphql.core import PostPython

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

runner = PostPython('/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()
print(response.json())
print(response.status_code)

Load environment variables

In PostPyGraphQL you can load environmental variables from postman environment files

pp.environments.load('environments/test.postman_environment.json')

Variable assignment

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

runner.environments.update({'BASE_URL': 'http://127.0.0.1:5000'})
runner.environments.update({'PASSWORD': 'test', 'EMAIL': 'you@email.com'})

AttributeError

Since RequestMethods and get_request does not really exists your intelligent IDE cannot help you. So PostPyGraphQL 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 "test.py", line 11, in <module>
response = runner.RequestMethods.get_requasts()
File "/usr/local/lib/python3.7/site-packages/postpygraphql/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()
>>> ...

>>> runner.RequestMethods.help()
>>> runner.RequestMethods.delete_request()
>>> runner.RequestMethods.patch_request()
>>> runner.RequestMethods.get_request()
>>> runner.RequestMethods.put_request()
>>> runner.RequestMethods.post_request()

Contribution

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

Metadata

Release files for postpygraphql 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for postpygraphql 0.0.5
File Size Uploaded Provenance Actions
postpygraphql-0.0.5.tar.gz 18.1 kB Without provenance Details for postpygraphql-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for postpygraphql 0.0.5
File Interpreter ABI Platform Actions
postpygraphql-0.0.5-py3-none-any.whl Python 3 none any Details for postpygraphql-0.0.5-py3-none-any.whl

Total release size: 36.8 kB

Release files / postpygraphql-0.0.5.tar.gz

Download URL postpygraphql-0.0.5.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0af61b27bd80ba6f58197cb05ca2d7784203d5515037efbbc9a78381c3e1b642
BLAKE2b-256 checksum
How to use checksums
4c9eb1d512034e83d7cf4ec6ac56f4a91b152b33fb0cebe265badaf5f3ee074e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Release files / postpygraphql-0.0.5-py3-none-any.whl

Download URL postpygraphql-0.0.5-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53152c50120f31e0cc58fc783c30dcf4c82480715097b5755d7db474e26d3334
BLAKE2b-256 checksum
How to use checksums
f0f6cf0ddd540463b37e9ac6148eca5a406d9a8a2737722130e2be79768732f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Security for postpygraphql 0.0.5

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page