{ "info": { "author": "Davide Moro", "author_email": "davide.moro@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "=============\nplay requests\n=============\n\n\n.. image:: https://img.shields.io/pypi/v/play_requests.svg\n :target: https://pypi.python.org/pypi/play_requests\n\n.. image:: https://travis-ci.org/davidemoro/play_requests.svg?branch=develop\n :target: https://travis-ci.org/davidemoro/play_requests\n\n.. image:: https://readthedocs.org/projects/play-requests/badge/?version=latest\n :target: https://play-requests.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://codecov.io/gh/davidemoro/play_requests/branch/develop/graph/badge.svg\n :target: https://codecov.io/gh/davidemoro/play_requests\n\n\npytest-play plugin driving the famous Python requests_ library for making ``HTTP`` calls.\n\nMore info and examples on:\n\n* pytest-play_, documentation\n* cookiecutter-qa_, see ``pytest-play`` in action with a working example if you want to start hacking\n\n\nFeatures\n--------\n\nThis pytest-play_ command provider let you drive a\nPython requests_ HTTP library using a YAML configuration file\ncontaining a set of pytest-play_ commands.\n\nyou can see a pytest-play_ script powered by a command provided\nby the play_requests_ plugin:\n\n::\n\n - provider: play_requests\n type: GET\n assertion: \"'pytest-play' in response.json()\"\n url: https://www.google.it/complete/search\n parameters:\n headers:\n Host: www.google.it\n User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101\n Firefox/57.0\n Accept: \"*/*\"\n Accept-Language: en-US,en;q=0.5\n Referer: https://www.google.it/\n Connection: keep-alive\n params:\n - - client\n - psy-ab\n - - hl\n - it\n - - gs_rn\n - '64'\n - - gs_ri\n - psy-ab\n - - gs_mss\n - pytest-\n - - cp\n - '11'\n - - gs_id\n - '172'\n - - q\n - pytest-play\n - - xhr\n - t\n timeout: 2.5\n\n\nThe above example:\n\n* performs a GET call to https://www.google.it/complete/search?client=psy-ab&hl=it&... \n with the provided headers, a timeout (if it takes more than 2.5 seconds a timeout\n exception will be raised) and an assertion expression that verifies that the response\n meets the expected value\n\nplay_requests_ supports all the HTTP verbs supported by the requests_ library:\n\n* OPTIONS\n* HEAD\n* GET\n* POST\n* PUT\n* PATCH\n* DELETE\n\nYou'll find other play_requests_ command examples in the following sections.\n\nAuthentication cookies\n======================\n\nManages cookies and prepare them for you so you don't have to create\ncookie headers by yourself using the ``auth=('username', 'password')``::\n\n - provider: play_requests\n type: GET\n url: http://something/authenticated\n parameters:\n auth:\n - username\n - password\n\nUpload files\n============\n\nPost a csv file::\n\n - provider: play_requests\n type: POST\n url: http://something/1\n parameters:\n files:\n filecsv:\n - report.csv\n - some,data\n\nPost a csv file with custom headers::\n\n - provider: play_requests\n type: POST\n url: http://something/1\n parameters:\n files:\n filecsv:\n - report.csv\n - some,data\n - application/csv\n - Expires: '0'\n\nPost a file providing the path::\n\n - provider: play_requests\n type: POST\n url: http://something/1\n parameters:\n files:\n filecsv:\n - file.csv\n - path:$base_path/file.csv\n\nassuming that you have a ``$base_path`` variable.\n\nSave the response to a variable\n===============================\n\nYou can save a response elaboration to a pytest-play_ variable\nand reuse in the following commands::\n\n - provider: play_requests\n type: POST\n url: http://something/1\n variable: myvar\n variable_expression: response.json()\n assertion: variables['myvar']['status'] == 'ok'\n parameters:\n json:\n foo: bar\n timeout: 2.5\n\nIt the endpoint returns a non JSON response, use ``response.text`` instead.\n\nDefault payload\n===============\n\nIf all your requests have a common payload it might be annoying\nbut thanks to play_requests_ you can avoid repetitions.\n\nYou can set variables in many ways programatically using the pytest-play_\nexecute command or execute commands. You can also update variables using\nthe play_python_ ``exec`` command::\n\n - provider: python\n type: store_variable\n name: bearer\n expression: \"'BEARER'\"\n - provider: python\n type: store_variable\n name: play_requests\n expression: \"{'parameters': {'headers': {'Authorization': '$bearer'}}}\"\n - provider: play_requests\n type: GET\n url: \"$base_url\"\n\nand all the following HTTP calls will be performed with the authorization bearer provided in the default\npayload.\n\nMerging rules:\n\n* if a play_requests_ command provides any other header value, the resulting HTTP call will be performed\n with merged header values (eg: ``Authorization`` + ``Host``)\n* if a play_requests_ command provides a conflicting header value or any other default option,\n the ``Authorization`` header provided by the command will win and it will override just for the current\n call the default conflicting header value\n\nAssert response status code\n===========================\n\n::\n\n - provider: play_requests\n type: POST\n url: http://something/1\n variable: myvar\n variable_expression: response.json()\n assertion: response.status_code == 200\n parameters:\n json:\n foo: bar\n\nof if you want you can use the expression ``response.raise_for_status()`` instead of\nchecking the exact match of status code.\n\nThe ``raise_for_status`` call will raise an ``HTTPError`` if the ``HTTP`` request\nreturned an unsuccessful status code.\n\n\nPost raw data\n=============\n\nIf you want to send some POST data or send a JSON payload without automatic JSON encoding::\n\n - provider: play_requests\n type: POST\n url: http://something/1\n parameters:\n data: '{\"foo\" : \"bar\" }'\n\nRedirections\n============\n\nBy default requests_ will perform location redirection for all verbs\nexcept HEAD:\n\n* http://docs.python-requests.org/en/master/user/quickstart/#redirection-and-history\n\nYou can disable or enable redirects playing with the ``allow_redirects`` option::\n\n - provider: play_requests\n type: POST\n url: http://something/1\n variable: myvar\n variable_expression: response.json()\n assertion: response.status_code == 200\n parameters:\n allow_redirects: false\n json:\n foo: bar\n\nTwitter\n-------\n\n``pytest-play`` tweets happens here:\n\n* `@davidemoro`_\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the cookiecutter-play-plugin_ (based on `audreyr/cookiecutter-pypackage`_ project template).\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n.. _`cookiecutter-play-plugin`: https://github.com/davidemoro/cookiecutter-play-plugin\n.. _pytest-play: https://github.com/davidemoro/pytest-play\n.. _cookiecutter-qa: https://github.com/davidemoro/cookiecutter-qa\n.. _requests: http://docs.python-requests.org/en/master/user/quickstart\n.. _play_requests: https://play_requests.readthedocs.io/en/latest\n.. _play_python: https://play_python.readthedocs.io/en/latest\n.. _`@davidemoro`: https://twitter.com/davidemoro\n\n\n=======\nCHANGES\n=======\n\n0.0.5 (2019-04-08)\n------------------\n\n- Manages cookies and prepare them for you so you don't have to create cookie\n headers by yourself using the ``auth=('username', 'password')``\n\n\n0.0.4 (2019-01-25)\n------------------\n\n- Supports new pytest-play >= 2.0 YAML based syntax (json no more supported)\n\n\n0.0.3 (2018-01-22)\n------------------\n\n- remove condition option (already implemented by pytest-play's ``skip_condition``)\n\n- documentation improvements\n\n\n0.0.2 (2018-01-16)\n------------------\n\n- Refactor internal methods\n\n- Remove merge commands with default payload (already\n implemented in ``pytest-play`` >= 1.1.0)\n\n\n0.0.1 (2018-01-10)\n------------------\n\n* First release\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/davidemoro/play_requests", "keywords": "play_requests", "license": "Apache Software License 2.0", "maintainer": "", "maintainer_email": "", "name": "play-requests", "package_url": "https://pypi.org/project/play-requests/", "platform": "", "project_url": "https://pypi.org/project/play-requests/", "project_urls": { "Homepage": "https://github.com/davidemoro/play_requests" }, "release_url": "https://pypi.org/project/play-requests/0.0.5/", "requires_dist": [ "requests", "pytest-play (>=2.0.0)", "pytest ; extra == 'tests'", "mock ; extra == 'tests'", "requests-mock ; extra == 'tests'", "pytest-cov ; extra == 'tests'" ], "requires_python": "", "summary": "pytest-play plugin driving the famous Python requests library for making HTTP calls", "version": "0.0.5" }, "last_serial": 5112232, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "9ac6ed95d8108ff09f567d65e0fbef62", "sha256": "57c782baf4d4a32febdd8d878c04f8ee1884f40014b6deff4ba32826517b7fcc" }, "downloads": -1, "filename": "play_requests-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9ac6ed95d8108ff09f567d65e0fbef62", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9975, "upload_time": "2018-01-10T09:59:54", "url": "https://files.pythonhosted.org/packages/52/a9/ecf2956495d9ed8ff7a962257c4ee391b8629a4d6f3d2e8591a9400cee4f/play_requests-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "562b41a1a88e8f560204473d109196d3", "sha256": "f98090174c6f2d17438938ccc365d43640e4d706a6a4e1fd8e8e256b50c0f686" }, "downloads": -1, "filename": "play_requests-0.0.1.tar.gz", "has_sig": false, "md5_digest": "562b41a1a88e8f560204473d109196d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20123, "upload_time": "2018-01-10T09:59:55", "url": "https://files.pythonhosted.org/packages/11/ee/0ae17a1da331a0cc43a4156d8019eea84610cd6077cdd325b343118bd914/play_requests-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "155e8686765e6fb1cc10983cdc29c2c4", "sha256": "ca57467b10e69578e54d4b0eb721f14da9bc910d1a25209477a07559e9a62023" }, "downloads": -1, "filename": "play_requests-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "155e8686765e6fb1cc10983cdc29c2c4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9754, "upload_time": "2018-01-16T14:32:03", "url": "https://files.pythonhosted.org/packages/26/0f/be963e978b7e92ae6a429b85a24d56efc6d4df385ca30f97928e7d328f95/play_requests-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61f4c0f1c13e3d9653d0bdc6591bbed6", "sha256": "62abfe2c542b1ae3512a08c32158108db7519adaf40e356e8b72a9562037ce41" }, "downloads": -1, "filename": "play_requests-0.0.2.tar.gz", "has_sig": false, "md5_digest": "61f4c0f1c13e3d9653d0bdc6591bbed6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19566, "upload_time": "2018-01-16T14:32:05", "url": "https://files.pythonhosted.org/packages/d0/c9/05c35f8d19d9f9294cb3c0fc5e19685d2915dcd01b41d647c21d091bf1d3/play_requests-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "4b06d350a274035f0b503827afcb80cb", "sha256": "af16e23a9818f46f4618d4386f15300c80c25aeb791c36e5f16f09a908acc441" }, "downloads": -1, "filename": "play_requests-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4b06d350a274035f0b503827afcb80cb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9565, "upload_time": "2018-01-22T11:54:32", "url": "https://files.pythonhosted.org/packages/5e/d7/bb74e89fb0afce995a538688545147d812bae0c7e1a50e6b24e976c643d0/play_requests-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "80e406a048e96e2c771a7d8385b604b0", "sha256": "9bc9cf449d8149e40244bc344e62f0d65e52139bbba70dfb6f9fd54f6193e0a6" }, "downloads": -1, "filename": "play_requests-0.0.3.tar.gz", "has_sig": false, "md5_digest": "80e406a048e96e2c771a7d8385b604b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19136, "upload_time": "2018-01-22T11:54:33", "url": "https://files.pythonhosted.org/packages/16/3d/e2f7c427408509a57543da869dd033114e184cc87ce0fe0f09b3a4eea3da/play_requests-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "34884c89fc5a87ab89124ee80cb3ee76", "sha256": "27f6eb64345c30dab0cf2a6d3213e20516c9e33ff82e2078438dee9c9817a18d" }, "downloads": -1, "filename": "play_requests-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "34884c89fc5a87ab89124ee80cb3ee76", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9863, "upload_time": "2019-01-25T23:05:23", "url": "https://files.pythonhosted.org/packages/67/27/b44b0592cac007c83eef5dcdd3206185afe9720b3f4d5147faec601b53bc/play_requests-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1287a2e5fc4769735065790de1372fd6", "sha256": "c4387dc43df0944624aa89e3b956a1e305414e53ca0863c7105c3f7f7bca4874" }, "downloads": -1, "filename": "play_requests-0.0.4.tar.gz", "has_sig": false, "md5_digest": "1287a2e5fc4769735065790de1372fd6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20266, "upload_time": "2019-01-25T23:05:25", "url": "https://files.pythonhosted.org/packages/2c/f1/b308d7f8913554c43562d7accf9f6883f2e1cf371876d9603de5eff284e2/play_requests-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "6e77f25465c84c4d7c59fa2c7c568ffc", "sha256": "0c5c8e9a09c806c383d62da9044918c3df48261cb7a41211df4eddc8dd8b5a29" }, "downloads": -1, "filename": "play_requests-0.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6e77f25465c84c4d7c59fa2c7c568ffc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9896, "upload_time": "2019-04-08T06:49:58", "url": "https://files.pythonhosted.org/packages/40/ac/b40659015844589bffbe58d1d1153750d5ca637a3cc42c79a5c321310c44/play_requests-0.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fbb7b661c1ec3134960307b16a5bed04", "sha256": "bc2ef513d8078acb61cd17ce0882a4c9168c859a490e1e3b700d1d14ddde1d49" }, "downloads": -1, "filename": "play_requests-0.0.5.tar.gz", "has_sig": false, "md5_digest": "fbb7b661c1ec3134960307b16a5bed04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21597, "upload_time": "2019-04-08T06:49:59", "url": "https://files.pythonhosted.org/packages/e0/9d/ff726a4616e053359712d55243a86e1905e85e7e7355761c137ee70ee700/play_requests-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6e77f25465c84c4d7c59fa2c7c568ffc", "sha256": "0c5c8e9a09c806c383d62da9044918c3df48261cb7a41211df4eddc8dd8b5a29" }, "downloads": -1, "filename": "play_requests-0.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6e77f25465c84c4d7c59fa2c7c568ffc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9896, "upload_time": "2019-04-08T06:49:58", "url": "https://files.pythonhosted.org/packages/40/ac/b40659015844589bffbe58d1d1153750d5ca637a3cc42c79a5c321310c44/play_requests-0.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fbb7b661c1ec3134960307b16a5bed04", "sha256": "bc2ef513d8078acb61cd17ce0882a4c9168c859a490e1e3b700d1d14ddde1d49" }, "downloads": -1, "filename": "play_requests-0.0.5.tar.gz", "has_sig": false, "md5_digest": "fbb7b661c1ec3134960307b16a5bed04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21597, "upload_time": "2019-04-08T06:49:59", "url": "https://files.pythonhosted.org/packages/e0/9d/ff726a4616e053359712d55243a86e1905e85e7e7355761c137ee70ee700/play_requests-0.0.5.tar.gz" } ] }