httpmock


Namehttpmock JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/thehale/httpmock
SummaryFluent API for mocking HTTP requests in Python tests
upload_time2024-06-04 17:33:20
maintainerNone
docs_urlNone
authorJoseph Hale
requires_python<4.0,>=3.8
licenseMPL-2.0
keywords test mock http httpretty
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--
 Copyright (c) 2024 Joseph Hale
 
 This Source Code Form is subject to the terms of the Mozilla Public
 License, v. 2.0. If a copy of the MPL was not distributed with this
 file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->

# httpmock

Fluent API for mocking HTTP requests in Python tests

<!-- BADGES -->
[![](https://badgen.net/github/license/thehale/httpmock)](https://github.com/thehale/httpmock/blob/master/LICENSE)
[![Sponsor Joseph Hale](https://badgen.net/badge/icon/Sponsor/pink?icon=github&label)](https://github.com/sponsors/thehale)
[![Joseph Hale's software engineering blog](https://jhale.dev/badges/website.svg)](https://jhale.dev)
[![Follow Joseph Hale!](https://jhale.dev/badges/follow.svg)](https://www.linkedin.com/comm/mynetwork/discovery-see-all?usecase=PEOPLE_FOLLOWS&followMember=thehale)


`httpmock` is essentially a thin wrapper around `httpretty` to give it a more fluent interface.

Example usage:

```python
import httpmock
import requests

@httpmock.enabled
def test_something():
    httpmock.on("GET", "http://example.com").respond(body="Hello, world!")
    assert requests.get("http://example.com").text == "Hello, world!"
```

Documentation for httpretty: https://httpretty.readthedocs.io/en/latest/index.html

## [License](/LICENSE)
Copyright (c) 2024 - Joseph Hale. All Rights Reserved.

```
httpmock by Joseph Hale is licensed under the terms of the Mozilla
Public License, v 2.0, which are available at https://mozilla.org/MPL/2.0/.

You can download the source code for httpmock for free from
https://github.com/thehale/httpmock.
```
<details>

<summary><b>What does the MPL-2.0 license allow/require?</b></summary>

### TL;DR

You can use files from this project in both open source and proprietary
applications, provided you include the above attribution. However, if
you modify any code in this project, or copy blocks of it into your own
code, you must publicly share the resulting files (note, not your whole
program) under the MPL-2.0. The best way to do this is via a Pull
Request back into this project.

If you have any other questions, you may also find Mozilla's [official
FAQ](https://www.mozilla.org/en-US/MPL/2.0/FAQ/) for the MPL-2.0 license
insightful.

If you dislike this license, you can contact me about negotiating a paid
contract with different terms.

**Disclaimer:** This TL;DR is just a summary. All legal questions
regarding usage of this project must be handled according to the
official terms specified in the `LICENSE` file.

### Why the MPL-2.0 license?

I believe that an open-source software license should ensure that code
can be used everywhere.

Strict copyleft licenses, like the GPL family of licenses, fail to
fulfill that vision because they only permit code to be used in other
GPL-licensed projects. Permissive licenses, like the MIT and Apache
licenses, allow code to be used everywhere but fail to prevent
proprietary or GPL-licensed projects from limiting access to any
improvements they make.

In contrast, the MPL-2.0 license allows code to be used in any software
project, while ensuring that any improvements remain available for
everyone.

</details>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/thehale/httpmock",
    "name": "httpmock",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "test, mock, http, httpretty",
    "author": "Joseph Hale",
    "author_email": "me@jhale.dev",
    "download_url": "https://files.pythonhosted.org/packages/bc/34/faeb2bdd5a3f8e091b19e8cd0dd0442a2d250a164713175dcacc879346b3/httpmock-0.1.0.tar.gz",
    "platform": null,
    "description": "<!--\n Copyright (c) 2024 Joseph Hale\n \n This Source Code Form is subject to the terms of the Mozilla Public\n License, v. 2.0. If a copy of the MPL was not distributed with this\n file, You can obtain one at http://mozilla.org/MPL/2.0/.\n-->\n\n# httpmock\n\nFluent API for mocking HTTP requests in Python tests\n\n<!-- BADGES -->\n[![](https://badgen.net/github/license/thehale/httpmock)](https://github.com/thehale/httpmock/blob/master/LICENSE)\n[![Sponsor Joseph Hale](https://badgen.net/badge/icon/Sponsor/pink?icon=github&label)](https://github.com/sponsors/thehale)\n[![Joseph Hale's software engineering blog](https://jhale.dev/badges/website.svg)](https://jhale.dev)\n[![Follow Joseph Hale!](https://jhale.dev/badges/follow.svg)](https://www.linkedin.com/comm/mynetwork/discovery-see-all?usecase=PEOPLE_FOLLOWS&followMember=thehale)\n\n\n`httpmock` is essentially a thin wrapper around `httpretty` to give it a more fluent interface.\n\nExample usage:\n\n```python\nimport httpmock\nimport requests\n\n@httpmock.enabled\ndef test_something():\n    httpmock.on(\"GET\", \"http://example.com\").respond(body=\"Hello, world!\")\n    assert requests.get(\"http://example.com\").text == \"Hello, world!\"\n```\n\nDocumentation for httpretty: https://httpretty.readthedocs.io/en/latest/index.html\n\n## [License](/LICENSE)\nCopyright (c) 2024 - Joseph Hale. All Rights Reserved.\n\n```\nhttpmock by Joseph Hale is licensed under the terms of the Mozilla\nPublic License, v 2.0, which are available at https://mozilla.org/MPL/2.0/.\n\nYou can download the source code for httpmock for free from\nhttps://github.com/thehale/httpmock.\n```\n<details>\n\n<summary><b>What does the MPL-2.0 license allow/require?</b></summary>\n\n### TL;DR\n\nYou can use files from this project in both open source and proprietary\napplications, provided you include the above attribution. However, if\nyou modify any code in this project, or copy blocks of it into your own\ncode, you must publicly share the resulting files (note, not your whole\nprogram) under the MPL-2.0. The best way to do this is via a Pull\nRequest back into this project.\n\nIf you have any other questions, you may also find Mozilla's [official\nFAQ](https://www.mozilla.org/en-US/MPL/2.0/FAQ/) for the MPL-2.0 license\ninsightful.\n\nIf you dislike this license, you can contact me about negotiating a paid\ncontract with different terms.\n\n**Disclaimer:** This TL;DR is just a summary. All legal questions\nregarding usage of this project must be handled according to the\nofficial terms specified in the `LICENSE` file.\n\n### Why the MPL-2.0 license?\n\nI believe that an open-source software license should ensure that code\ncan be used everywhere.\n\nStrict copyleft licenses, like the GPL family of licenses, fail to\nfulfill that vision because they only permit code to be used in other\nGPL-licensed projects. Permissive licenses, like the MIT and Apache\nlicenses, allow code to be used everywhere but fail to prevent\nproprietary or GPL-licensed projects from limiting access to any\nimprovements they make.\n\nIn contrast, the MPL-2.0 license allows code to be used in any software\nproject, while ensuring that any improvements remain available for\neveryone.\n\n</details>\n",
    "bugtrack_url": null,
    "license": "MPL-2.0",
    "summary": "Fluent API for mocking HTTP requests in Python tests",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://github.com/thehale/httpmock",
        "Homepage": "https://github.com/thehale/httpmock",
        "Repository": "https://github.com/thehale/httpmock"
    },
    "split_keywords": [
        "test",
        " mock",
        " http",
        " httpretty"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6a42f24c5517bd5416da703e5b960045b4730540e81715a2884879178781d8a3",
                "md5": "e53c1eed7ff65e200ced1d7c0f9c09b4",
                "sha256": "c4ee148d7fe7a8aa223b1676aa7620928f3834f1c663d4cb4a7a77bcb5e8d05f"
            },
            "downloads": -1,
            "filename": "httpmock-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e53c1eed7ff65e200ced1d7c0f9c09b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 9472,
            "upload_time": "2024-06-04T17:33:19",
            "upload_time_iso_8601": "2024-06-04T17:33:19.724365Z",
            "url": "https://files.pythonhosted.org/packages/6a/42/f24c5517bd5416da703e5b960045b4730540e81715a2884879178781d8a3/httpmock-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bc34faeb2bdd5a3f8e091b19e8cd0dd0442a2d250a164713175dcacc879346b3",
                "md5": "d236a4e3950319657886a85fcf9ed100",
                "sha256": "b00b6e95aebd09f0fdb022cd734f9d5a81e64530bd245dfc1e3913e042c6bcb0"
            },
            "downloads": -1,
            "filename": "httpmock-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d236a4e3950319657886a85fcf9ed100",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 8380,
            "upload_time": "2024-06-04T17:33:20",
            "upload_time_iso_8601": "2024-06-04T17:33:20.883530Z",
            "url": "https://files.pythonhosted.org/packages/bc/34/faeb2bdd5a3f8e091b19e8cd0dd0442a2d250a164713175dcacc879346b3/httpmock-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-04 17:33:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thehale",
    "github_project": "httpmock",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "httpmock"
}
        
Elapsed time: 1.72981s