fauxhttp


Namefauxhttp JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://httpretty.readthedocs.io/en/latest/
SummaryHTTP client mock for Python
upload_time2024-10-16 22:06:07
maintainerNone
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": "fauxhttp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": null,
    "keywords": null,
    "author": "Gabriel Falcao",
    "author_email": "gabriel@nacaolivre.org",
    "download_url": "https://files.pythonhosted.org/packages/78/40/f3d26ae41d46e953b3b59797b71734869e4ff62bae3a6bfe193118582591/fauxhttp-0.1.0.tar.gz",
    "platform": null,
    "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>`_\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "HTTP client mock for Python",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://httpretty.readthedocs.io/en/latest/",
        "Homepage": "https://httpretty.readthedocs.io/en/latest/",
        "Issue Tracker": "https://github.com/Secrus/fauxhttp/issues",
        "Source Code": "https://github.com/Secrus/fauxhttp"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c25e9803d323dd2d6cbb0286d6d52577a427091c579ff5276858fcada75d7ed4",
                "md5": "1408516dd446ca0770f017c914945fd4",
                "sha256": "ffa093b81214c695dd68470269232bafb7568c9cd330bd1299ea3253a5b3a794"
            },
            "downloads": -1,
            "filename": "fauxhttp-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1408516dd446ca0770f017c914945fd4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 28788,
            "upload_time": "2024-10-16T22:06:05",
            "upload_time_iso_8601": "2024-10-16T22:06:05.527288Z",
            "url": "https://files.pythonhosted.org/packages/c2/5e/9803d323dd2d6cbb0286d6d52577a427091c579ff5276858fcada75d7ed4/fauxhttp-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7840f3d26ae41d46e953b3b59797b71734869e4ff62bae3a6bfe193118582591",
                "md5": "79bdb0a28c439d68debeaf70c16e5662",
                "sha256": "c2ebb28be30cdc30b87882633d12d043a539b060c332b9d7ef4762779faccd4e"
            },
            "downloads": -1,
            "filename": "fauxhttp-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "79bdb0a28c439d68debeaf70c16e5662",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 70370,
            "upload_time": "2024-10-16T22:06:07",
            "upload_time_iso_8601": "2024-10-16T22:06:07.804885Z",
            "url": "https://files.pythonhosted.org/packages/78/40/f3d26ae41d46e953b3b59797b71734869e4ff62bae3a6bfe193118582591/fauxhttp-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-16 22:06:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Secrus",
    "github_project": "fauxhttp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "fauxhttp"
}
        
Elapsed time: 0.71373s