{ "info": { "author": "Bradley Wood", "author_email": "github@bradleywood.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Environment :: Web Environment", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Browsers", "Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Software Development :: Build Tools", "Topic :: System :: Installation/Setup", "Topic :: System :: Systems Administration", "Topic :: Utilities" ], "description": "BPRC\n====\n\n|Build Status| |codecov| |PyPI version| |PyPI status| |license|\n\nBatch Processing RESTFul Client\n===============================\n\nA Dev/DevOps tool to automate calling a set of RESTFul JSON endpoints,\nwith the ability to grab data from the JSON payload and use it in\nsubsequent calls in the recipe.\n\nWhat it does\n------------\n\nIf you're a Dev/DevOps engineer you may have been faced with a situation\nwhere you find yourself writing a shell script to automate getting JSON\ndata from one or more RESTful endpoints using ``curl`` or ``wget`` or\n``httpie``, and then parsing the output using ``sed``, ``grep`` or\n``jq``. This tool is designed to provide a generic, simplied, yet\npowerful means of writing such scripts in the form of a simple *recipe*\nspecification, rather than a shell script.\n\nIt relies on the excellent `Pygments `__ and\n`Requests `__ libraries.\n\nTo install\n----------\n\nThis is a Python application which is written in Python 3. It has only\ncurrently been tested on Linux (Ubuntu 14.04).\n\nPre-requisites\n~~~~~~~~~~~~~~\n\nMake sure you've installed Python 3 and Pip 3\n\n.. code:: bash\n\n $ apt-get install -y python3\n $ apt-get install -y python3-pip\n\nInstallation\n~~~~~~~~~~~~\n\nInstall like this:\n\n.. code:: bash\n\n $ pip3 install bprc\n\nOr a tagged version directly from GitHub (as PyPI can sometimes be\nerratic)\n\n.. code:: bash\n\n $ pip3 install https://github.com/bradwood/BPRC/tarball/x.y.x # replace with version tag in GitHub, no tar.gz extension needed\n\nHow it works\n------------\n\nThe recipe is specified in a single YAML file which describes: - A list\nof variables that are initialised at the top of the recipe for use in\nthe steps below. - A list of ordered steps that comprise the recipe,\neach containing some or all of the below: - the URL that need to be\nvisited - the HTTP method to use - the headers, querystring and body\ndata to include in the step - specific options to pass into the this\nstep -- currently only the following options are supported: -\n``request.retries`` - set to the number of retries to attempt on the\nstep in question. Only works for non-mutating calls (e.g., GETs),\ndefaults to 3. - ``request.body_format`` - can be set to ``json``\n(default) or ``form``. Will assemble the request body as either\nform-encoded or json and set the ``Content-type:`` header to\n``application/x-www-form-urlencoded`` or ``application/json``\nrespectively.\n\nAdditionally, the YAML recipe file supports the ability to grab data\nfrom any part of any of the HTTP requests or responses in earlier steps\nin the recipe and insert them into later steps using a PHP-like\nconstruct. For example, say I have a 10-step recipe specified and in\nstep 7 I need to POST some data that I received in step 3's reponse. I\ncan include a construct like this in any part of the YAML file:\n\n::\n\n <%=steps[3].response.body[\"id\"]%>\n\nAssuming that step 3 did indeed contain a parameter called ``id`` in\nit's JSON response payload, this data will then be substituted in the\nspecified part of step 10's request.\n\nThe insertion of variables anywhare in the recipe is done as shown:\n\n::\n\n <%!varname%>\n\nFiles can also be included into a recipe using a construct like this:\n\n::\n\n <%f/path/to/file.txt%>\n\nSample Recipe\n~~~~~~~~~~~~~\n\nThis functionality is best illustrated with a complete recipe file as\nshown below.\n\n.. code:: yaml\n\n --- #sample recipe\n variables:\n name: brad\n favourite_colour: red\n age: 345\n drinks_beer: true\n age_and_colour: <%!age%>:<%!favourite_colour%>\n lorumfile: <%f./examples/lorum.txt%>\n\n recipe:\n - # step0\n name: Call Mockbin # see http://mockbin.org/docs#http-request\n httpmethod: POST\n # using the HTTP Basic auth process to see if the Authorization: header\n # is visible in the output file.\n URL: http://Aladdin:OpenSesame@mockbin.org/request/path/to/<%!name%>\n request:\n body:\n name: My name is <%!name%>\n age: I am <%!age%> years old.\n beer_drinker: <%!drinks_beer%>\n lorum_impsum: <%!lorumfile%>\n querystring:\n colors: blue, green, <%!favourite_colour%>\n headers:\n X-info: <%!age_and_colour%>\n - \n name: Call Mockbin with data from the previous call.\n httpmethod: GET\n options:\n request.retries: 10 #set retries to 10, overriding the default of 3.\n URL: http://mockbin.org/request/path/to/<%!name%>\n request:\n headers:\n date_header_from_previous_call: <%=steps[0].response.headers[\"Date\"]%>\n body:\n http_response_code_from_previous_call: <%=steps[0].response.code%>\n\nOther features\n--------------\n\n``bprc`` provides the following features: - robust logging support -\nsaving output files as raw HTTP (response only, or both request and\nresponse) or JSON - SSL support (including the ability to ingore invalid\nserver certificates) - verbose and/or debug output - HTTP request bodies\nformatted either as JSON or form-encoded - Pretty-printed output\n\nKnown issues/shortcomings\n-------------------------\n\nThe following are known areas for improvement: - poor tolerance of badly\nformatted YAML - ``--dry-run`` option not implemented - poor test\ncoverage and test automation - only handles JSON in the response bodies,\nXML or ther payload types are not supported.\n\nPlanned improvements\n--------------------\n\n- improving error handling\n- better test coverage\n- Implementing ``--dry-run``\n- passing an entire payload, rather than just a single parameter, using\n a file include\n- setting a recipe variable via cli and/or environment variable\n\nContributing\n------------\n\nContributions are welcome! Please fork, make your changes, add tests to\ncover your work and then raise a pull request.\n\n.. |Build Status| image:: https://travis-ci.org/bradwood/BPRC.svg?branch=master\n :target: https://travis-ci.org/bradwood/BPRC\n.. |codecov| image:: https://codecov.io/gh/bradwood/BPRC/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/bradwood/BPRC\n.. |PyPI version| image:: https://badge.fury.io/py/bprc.svg\n :target: https://badge.fury.io/py/bprc\n.. |PyPI status| image:: https://img.shields.io/pypi/status/bprc.svg\n :target: https://pypi.python.org/pypi/bprc\n.. |license| image:: https://img.shields.io/github/license/bradwood/bprc.svg\n :target: https://github.com/bradwood/BPRC/blob/master/LICENSE", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/bradwood/BPRC/tarball/0.7.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bradwood/BPRC", "keywords": "devops REST json microservices yaml script", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "bprc", "package_url": "https://pypi.org/project/bprc/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/bprc/", "project_urls": { "Download": "https://github.com/bradwood/BPRC/tarball/0.7.0", "Homepage": "https://github.com/bradwood/BPRC" }, "release_url": "https://pypi.org/project/bprc/0.7.0/", "requires_dist": null, "requires_python": null, "summary": "Batch Processing RESTful Client", "version": "0.7.0" }, "last_serial": 2294208, "releases": { "0.6.8": [ { "comment_text": "built for Linux-4.4.15-moby-x86_64-with-glibc2.9", "digests": { "md5": "282c9e598ad0b5a456ef2d1178c58646", "sha256": "015ab3904dbf4cc689294156dd8cc03fa9a9be9605f3b736e1a73ef37841bfd0" }, "downloads": -1, "filename": "bprc-0.6.8.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "282c9e598ad0b5a456ef2d1178c58646", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 33939, "upload_time": "2016-08-10T16:10:19", "url": "https://files.pythonhosted.org/packages/ca/d7/707323625c325b206b60590f2cce155a427f6fad23c56e7db7fed4ed22a8/bprc-0.6.8.linux-x86_64.tar.gz" } ], "0.6.9": [ { "comment_text": "built for Linux-4.4.15-moby-x86_64-with-glibc2.9", "digests": { "md5": "31a7f25b0c82e6a6e7dbe49124d03550", "sha256": "1b43a33690f1658c878035cacce4106966ce7f018ed05a924181324e6f7fd53a" }, "downloads": -1, "filename": "bprc-0.6.9.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "31a7f25b0c82e6a6e7dbe49124d03550", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 41130, "upload_time": "2016-08-15T22:34:18", "url": "https://files.pythonhosted.org/packages/ca/18/c23012620ff75a0f98ea6aee8eb8dff206be15c527a5bdf52c760bffbd0a/bprc-0.6.9.linux-x86_64.tar.gz" } ], "0.7.0": [ { "comment_text": "built for Linux-4.4.15-moby-x86_64-with-glibc2.9", "digests": { "md5": "8ce8d82b43b3ad4f6d0650e5169c1fa9", "sha256": "39170787c38c68e56ca6603ab8eb501fca6362360cc6ddc1ba88ede3abb228db" }, "downloads": -1, "filename": "bprc-0.7.0.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "8ce8d82b43b3ad4f6d0650e5169c1fa9", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 43025, "upload_time": "2016-08-21T18:26:59", "url": "https://files.pythonhosted.org/packages/4a/18/2cbd498c08b54421d7443f47b89feb3a1494c906e898cb6cde3f29464064/bprc-0.7.0.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "82b935980adecc83c8ed1adb0703acda", "sha256": "019dae039de50b836189a205d54dc25d4f0bb96dc4748d011bd4f703c18cdb69" }, "downloads": -1, "filename": "bprc-0.7.0-py3-none-any.whl", "has_sig": false, "md5_digest": "82b935980adecc83c8ed1adb0703acda", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 32730, "upload_time": "2016-08-21T18:36:29", "url": "https://files.pythonhosted.org/packages/f5/59/409c27650c02ad7b6f6e69eb2bdfc921266e1b3315cc691627b79cdf4f21/bprc-0.7.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06c7bf5d6179b65dbef8a491c6b5831c", "sha256": "7a95a30399c5432aa5343afa699bd2ed526e83dc9d9619f40edf0cac7fbef74b" }, "downloads": -1, "filename": "bprc-0.7.0.tar.gz", "has_sig": false, "md5_digest": "06c7bf5d6179b65dbef8a491c6b5831c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22326, "upload_time": "2016-08-21T18:36:26", "url": "https://files.pythonhosted.org/packages/65/cc/b57da55e9cb41e3603c4dd2eb73db1b7fab7224e1d90edf2e69457d5b7b0/bprc-0.7.0.tar.gz" } ] }, "urls": [ { "comment_text": "built for Linux-4.4.15-moby-x86_64-with-glibc2.9", "digests": { "md5": "8ce8d82b43b3ad4f6d0650e5169c1fa9", "sha256": "39170787c38c68e56ca6603ab8eb501fca6362360cc6ddc1ba88ede3abb228db" }, "downloads": -1, "filename": "bprc-0.7.0.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "8ce8d82b43b3ad4f6d0650e5169c1fa9", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 43025, "upload_time": "2016-08-21T18:26:59", "url": "https://files.pythonhosted.org/packages/4a/18/2cbd498c08b54421d7443f47b89feb3a1494c906e898cb6cde3f29464064/bprc-0.7.0.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "82b935980adecc83c8ed1adb0703acda", "sha256": "019dae039de50b836189a205d54dc25d4f0bb96dc4748d011bd4f703c18cdb69" }, "downloads": -1, "filename": "bprc-0.7.0-py3-none-any.whl", "has_sig": false, "md5_digest": "82b935980adecc83c8ed1adb0703acda", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 32730, "upload_time": "2016-08-21T18:36:29", "url": "https://files.pythonhosted.org/packages/f5/59/409c27650c02ad7b6f6e69eb2bdfc921266e1b3315cc691627b79cdf4f21/bprc-0.7.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06c7bf5d6179b65dbef8a491c6b5831c", "sha256": "7a95a30399c5432aa5343afa699bd2ed526e83dc9d9619f40edf0cac7fbef74b" }, "downloads": -1, "filename": "bprc-0.7.0.tar.gz", "has_sig": false, "md5_digest": "06c7bf5d6179b65dbef8a491c6b5831c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22326, "upload_time": "2016-08-21T18:36:26", "url": "https://files.pythonhosted.org/packages/65/cc/b57da55e9cb41e3603c4dd2eb73db1b7fab7224e1d90edf2e69457d5b7b0/bprc-0.7.0.tar.gz" } ] }