httpretty


Namehttpretty JSON
Version 1.1.4 PyPI version JSON
download
home_pagehttps://httpretty.readthedocs.io/en/latest/
SummaryHTTP client mock for Python
upload_time2021-08-16 19:35:31
maintainer
docs_urlNone
authorGabriel Falcao
requires_python>=3
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            HTTPretty 1.1.4
===============

.. image:: https://github.com/gabrielfalcao/HTTPretty/raw/master/docs/source/_static/logo.svg?sanitize=true

HTTP Client mocking tool for Python created by `Gabriel Falcão <https://github.com/gabrielfalcao>`_ . It provides a full fake TCP socket module. Inspired by `FakeWeb <https://github.com/chrisk/fakeweb>`_


- `Github Repository <https://github.com/gabrielfalcao/HTTPretty>`_
- `Documentation <https://httpretty.readthedocs.io/en/latest/>`_
- `PyPI Package <https://pypi.org/project/httpretty/>`_


**Python Support:**

- **3.6**
- **3.7**
- **3.8**
- **3.9**

.. image:: https://img.shields.io/pypi/dm/HTTPretty
   :target: https://pypi.org/project/HTTPretty

.. image:: https://img.shields.io/codecov/c/github/gabrielfalcao/HTTPretty
   :target: https://codecov.io/gh/gabrielfalcao/HTTPretty

.. image:: https://img.shields.io/github/workflow/status/gabrielfalcao/HTTPretty/HTTPretty%20Tests?label=Python%203.6%20-%203.9
   :target: https://github.com/gabrielfalcao/HTTPretty/actions

.. image:: https://img.shields.io/readthedocs/httpretty
   :target: https://httpretty.readthedocs.io/

.. image:: https://img.shields.io/github/license/gabrielfalcao/HTTPretty?label=Github%20License
   :target: https://github.com/gabrielfalcao/HTTPretty/blob/master/COPYING

.. image:: https://img.shields.io/pypi/v/HTTPretty
   :target: https://pypi.org/project/HTTPretty

.. image:: https://img.shields.io/pypi/l/HTTPretty?label=PyPi%20License
   :target: https://pypi.org/project/HTTPretty

.. image:: https://img.shields.io/pypi/format/HTTPretty
   :target: https://pypi.org/project/HTTPretty

.. image:: https://img.shields.io/pypi/status/HTTPretty
   :target: https://pypi.org/project/HTTPretty

.. image:: https://img.shields.io/pypi/pyversions/HTTPretty
   :target: https://pypi.org/project/HTTPretty

.. image:: https://img.shields.io/pypi/implementation/HTTPretty
   :target: https://pypi.org/project/HTTPretty

.. image:: https://img.shields.io/snyk/vulnerabilities/github/gabrielfalcao/HTTPretty
   :target: https://github.com/gabrielfalcao/HTTPretty/network/alerts

.. image:: https://img.shields.io/github/v/tag/gabrielfalcao/HTTPretty
   :target: https://github.com/gabrielfalcao/HTTPretty/releases

.. |Join the chat at https://gitter.im/gabrielfalcao/HTTPretty| image:: https://badges.gitter.im/gabrielfalcao/HTTPretty.svg
   :target: https://gitter.im/gabrielfalcao/HTTPretty?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

Install
-------

.. code:: bash

   pip install httpretty



Common Use Cases
================

- Test-driven development of API integrations
- Fake responses of external APIs
- Record and playback HTTP requests


Simple Example
--------------

.. code:: python

    import sure
    import httpretty
    import requests


    @httpretty.activate(verbose=True, allow_net_connect=False)
    def test_httpbin():
        httpretty.register_uri(
            httpretty.GET,
            "https://httpbin.org/ip",
            body='{"origin": "127.0.0.1"}'
        )

        response = requests.get('https://httpbin.org/ip')
        response.json().should.equal({'origin': '127.0.0.1'})

        httpretty.latest_requests().should.have.length_of(1)
        httpretty.last_request().should.equal(httpretty.latest_requests()[0])
        httpretty.last_request().body.should.equal('{"origin": "127.0.0.1"}')


checking multiple responses
---------------------------

 .. code:: python

    @httpretty.activate(verbose=True, allow_net_connect=False)
    def test_post_bodies():
        url = 'http://httpbin.org/post'
        httpretty.register_uri(httpretty.POST, url, status=200)
        httpretty.register_uri(httpretty.POST, url, status=400)
        requests.post(url, data={'foo': 'bar'})
        requests.post(url, data={'zoo': 'zoo'})
        assert 'foo=bar' in httpretty.latest_requests()[0].body
        assert 'zoo=bar' in httpretty.latest_requests()[1].body


License
=======

::

    <HTTPretty - HTTP client mock for Python>
    Copyright (C) <2011-2021> Gabriel Falcão <gabriel@nacaolivre.org>

    Permission is hereby granted, free of charge, to any person
    obtaining a copy of this software and associated documentation
    files (the "Software"), to deal in the Software without
    restriction, including without limitation the rights to use,
    copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following
    conditions:

    The above copyright notice and this permission notice shall be
    included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    OTHER DEALINGS IN THE SOFTWARE.

Main contributors
=================

HTTPretty has received `many contributions <https://github.com/gabrielfalcao/HTTPretty/graphs/contributors>`_
but some folks made remarkable contributions and deserve extra credit:

-  Andrew Gross ~> `@andrewgross <https://github.com/andrewgross>`_
-  Hugh Saunders ~> `@hughsaunders <https://github.com/hughsaunders>`_
-  James Rowe ~> `@JNRowe <https://github.com/JNRowe>`_
-  Matt Luongo ~> `@mhluongo <https://github.com/mhluongo>`_
-  Steve Pulec ~> `@spulec <https://github.com/spulec>`_
-  Miro Hrončok ~> `@hroncok <https://github.com/hroncok>`_
   Mario Jonke ~> `@mariojonke <https://github.com/mariojonke>`_
            

Raw data

            {
    "_id": null,
    "home_page": "https://httpretty.readthedocs.io/en/latest/",
    "name": "httpretty",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "",
    "author": "Gabriel Falcao",
    "author_email": "gabriel@nacaolivre.org",
    "download_url": "https://files.pythonhosted.org/packages/6e/19/850b7ed736319d0c4088581f4fc34f707ef14461947284026664641e16d4/httpretty-1.1.4.tar.gz",
    "platform": "",
    "description": "HTTPretty 1.1.4\n===============\n\n.. image:: https://github.com/gabrielfalcao/HTTPretty/raw/master/docs/source/_static/logo.svg?sanitize=true\n\nHTTP Client mocking tool for Python created by `Gabriel Falc\u00e3o <https://github.com/gabrielfalcao>`_ . It provides a full fake TCP socket module. Inspired by `FakeWeb <https://github.com/chrisk/fakeweb>`_\n\n\n- `Github Repository <https://github.com/gabrielfalcao/HTTPretty>`_\n- `Documentation <https://httpretty.readthedocs.io/en/latest/>`_\n- `PyPI Package <https://pypi.org/project/httpretty/>`_\n\n\n**Python Support:**\n\n- **3.6**\n- **3.7**\n- **3.8**\n- **3.9**\n\n.. image:: https://img.shields.io/pypi/dm/HTTPretty\n   :target: https://pypi.org/project/HTTPretty\n\n.. image:: https://img.shields.io/codecov/c/github/gabrielfalcao/HTTPretty\n   :target: https://codecov.io/gh/gabrielfalcao/HTTPretty\n\n.. image:: https://img.shields.io/github/workflow/status/gabrielfalcao/HTTPretty/HTTPretty%20Tests?label=Python%203.6%20-%203.9\n   :target: https://github.com/gabrielfalcao/HTTPretty/actions\n\n.. image:: https://img.shields.io/readthedocs/httpretty\n   :target: https://httpretty.readthedocs.io/\n\n.. image:: https://img.shields.io/github/license/gabrielfalcao/HTTPretty?label=Github%20License\n   :target: https://github.com/gabrielfalcao/HTTPretty/blob/master/COPYING\n\n.. image:: https://img.shields.io/pypi/v/HTTPretty\n   :target: https://pypi.org/project/HTTPretty\n\n.. image:: https://img.shields.io/pypi/l/HTTPretty?label=PyPi%20License\n   :target: https://pypi.org/project/HTTPretty\n\n.. image:: https://img.shields.io/pypi/format/HTTPretty\n   :target: https://pypi.org/project/HTTPretty\n\n.. image:: https://img.shields.io/pypi/status/HTTPretty\n   :target: https://pypi.org/project/HTTPretty\n\n.. image:: https://img.shields.io/pypi/pyversions/HTTPretty\n   :target: https://pypi.org/project/HTTPretty\n\n.. image:: https://img.shields.io/pypi/implementation/HTTPretty\n   :target: https://pypi.org/project/HTTPretty\n\n.. image:: https://img.shields.io/snyk/vulnerabilities/github/gabrielfalcao/HTTPretty\n   :target: https://github.com/gabrielfalcao/HTTPretty/network/alerts\n\n.. image:: https://img.shields.io/github/v/tag/gabrielfalcao/HTTPretty\n   :target: https://github.com/gabrielfalcao/HTTPretty/releases\n\n.. |Join the chat at https://gitter.im/gabrielfalcao/HTTPretty| image:: https://badges.gitter.im/gabrielfalcao/HTTPretty.svg\n   :target: https://gitter.im/gabrielfalcao/HTTPretty?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n\nInstall\n-------\n\n.. code:: bash\n\n   pip install httpretty\n\n\n\nCommon Use Cases\n================\n\n- Test-driven development of API integrations\n- Fake responses of external APIs\n- Record and playback HTTP requests\n\n\nSimple Example\n--------------\n\n.. code:: python\n\n    import sure\n    import httpretty\n    import requests\n\n\n    @httpretty.activate(verbose=True, allow_net_connect=False)\n    def test_httpbin():\n        httpretty.register_uri(\n            httpretty.GET,\n            \"https://httpbin.org/ip\",\n            body='{\"origin\": \"127.0.0.1\"}'\n        )\n\n        response = requests.get('https://httpbin.org/ip')\n        response.json().should.equal({'origin': '127.0.0.1'})\n\n        httpretty.latest_requests().should.have.length_of(1)\n        httpretty.last_request().should.equal(httpretty.latest_requests()[0])\n        httpretty.last_request().body.should.equal('{\"origin\": \"127.0.0.1\"}')\n\n\nchecking multiple responses\n---------------------------\n\n .. code:: python\n\n    @httpretty.activate(verbose=True, allow_net_connect=False)\n    def test_post_bodies():\n        url = 'http://httpbin.org/post'\n        httpretty.register_uri(httpretty.POST, url, status=200)\n        httpretty.register_uri(httpretty.POST, url, status=400)\n        requests.post(url, data={'foo': 'bar'})\n        requests.post(url, data={'zoo': 'zoo'})\n        assert 'foo=bar' in httpretty.latest_requests()[0].body\n        assert 'zoo=bar' in httpretty.latest_requests()[1].body\n\n\nLicense\n=======\n\n::\n\n    <HTTPretty - HTTP client mock for Python>\n    Copyright (C) <2011-2021> Gabriel Falc\u00e3o <gabriel@nacaolivre.org>\n\n    Permission is hereby granted, free of charge, to any person\n    obtaining a copy of this software and associated documentation\n    files (the \"Software\"), to deal in the Software without\n    restriction, including without limitation the rights to use,\n    copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the\n    Software is furnished to do so, subject to the following\n    conditions:\n\n    The above copyright notice and this permission notice shall be\n    included in all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n    OTHER DEALINGS IN THE SOFTWARE.\n\nMain contributors\n=================\n\nHTTPretty has received `many contributions <https://github.com/gabrielfalcao/HTTPretty/graphs/contributors>`_\nbut some folks made remarkable contributions and deserve extra credit:\n\n-  Andrew Gross ~> `@andrewgross <https://github.com/andrewgross>`_\n-  Hugh Saunders ~> `@hughsaunders <https://github.com/hughsaunders>`_\n-  James Rowe ~> `@JNRowe <https://github.com/JNRowe>`_\n-  Matt Luongo ~> `@mhluongo <https://github.com/mhluongo>`_\n-  Steve Pulec ~> `@spulec <https://github.com/spulec>`_\n-  Miro Hron\u010dok ~> `@hroncok <https://github.com/hroncok>`_\n   Mario Jonke ~> `@mariojonke <https://github.com/mariojonke>`_",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "HTTP client mock for Python",
    "version": "1.1.4",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "6f00d23684900c645aba1bb46b2eb320",
                "sha256": "20de0e5dd5a18292d36d928cc3d6e52f8b2ac73daec40d41eb62dee154933b68"
            },
            "downloads": -1,
            "filename": "httpretty-1.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "6f00d23684900c645aba1bb46b2eb320",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 442389,
            "upload_time": "2021-08-16T19:35:31",
            "upload_time_iso_8601": "2021-08-16T19:35:31.400695Z",
            "url": "https://files.pythonhosted.org/packages/6e/19/850b7ed736319d0c4088581f4fc34f707ef14461947284026664641e16d4/httpretty-1.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-08-16 19:35:31",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "httpretty"
}
        
Elapsed time: 0.01987s