DESCRIPTION.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. HTTPretty 0.9.6
  2. ===============
  3. HTTP Client mocking tool for Python. Provides a full fake TCP socket module. Inspired by `FakeWeb <https://github.com/chrisk/fakeweb>`_
  4. - `Github Repository <https://github.com/gabrielfalcao/HTTPretty>`_
  5. - `Documentation <https://httpretty.readthedocs.io/en/latest/>`_
  6. - `PyPI Package <https://pypi.org/project/httpretty/>`_
  7. **Python Support:**
  8. - **2.7.13**
  9. - **3.6.5**
  10. .. image:: https://github.com/gabrielfalcao/HTTPretty/raw/master/docs/source/_static/logo.svg?sanitize=true
  11. .. image:: https://readthedocs.org/projects/httpretty/badge/?version=latest
  12. :target: http://httpretty.readthedocs.io/en/latest/?badge=latest
  13. :alt: Documentation Status
  14. .. image:: https://travis-ci.org/gabrielfalcao/HTTPretty.svg?branch=master
  15. :target: https://travis-ci.org/gabrielfalcao/HTTPretty
  16. .. |PyPI python versions| image:: https://img.shields.io/pypi/pyversions/HTTPretty.svg
  17. :target: https://pypi.python.org/pypi/HTTPretty
  18. .. |Join the chat at https://gitter.im/gabrielfalcao/HTTPretty| image:: https://badges.gitter.im/gabrielfalcao/HTTPretty.svg
  19. :target: https://gitter.im/gabrielfalcao/HTTPretty?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
  20. Install
  21. -------
  22. .. code:: bash
  23. pip install httpretty
  24. Common Use Cases
  25. ================
  26. - Test-driven development of API integrations
  27. - Fake responses of external APIs
  28. - Record and playback HTTP requests
  29. Simple Example
  30. --------------
  31. .. code:: python
  32. import sure
  33. import httpretty
  34. import requests
  35. @httpretty.activate
  36. def test_httpbin():
  37. httpretty.register_uri(
  38. httpretty.GET,
  39. "https://httpbin.org/ip",
  40. body='{"origin": "127.0.0.1"}'
  41. )
  42. response = requests.get('https://httpbin.org/ip')
  43. response.json().should.equal({'origin': '127.0.0.1'})
  44. License
  45. =======
  46. ::
  47. <HTTPretty - HTTP client mock for Python>
  48. Copyright (C) <2011-2018> Gabriel Falcão <gabriel@nacaolivre.org>
  49. Permission is hereby granted, free of charge, to any person
  50. obtaining a copy of this software and associated documentation
  51. files (the "Software"), to deal in the Software without
  52. restriction, including without limitation the rights to use,
  53. copy, modify, merge, publish, distribute, sublicense, and/or sell
  54. copies of the Software, and to permit persons to whom the
  55. Software is furnished to do so, subject to the following
  56. conditions:
  57. The above copyright notice and this permission notice shall be
  58. included in all copies or substantial portions of the Software.
  59. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  60. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  61. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  62. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  63. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  64. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  65. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  66. OTHER DEALINGS IN THE SOFTWARE.
  67. Main contributors
  68. =================
  69. HTTPretty has received `many contributions <https://github.com/gabrielfalcao/HTTPretty/graphs/contributors>`_
  70. but some folks made remarkable contributions and deserve extra credit:
  71. - Andrew Gross ~> `@andrewgross <https://github.com/andrewgross>`_
  72. - Hugh Saunders ~> `@hughsaunders <https://github.com/hughsaunders>`_
  73. - James Rowe ~> `@JNRowe <https://github.com/JNRowe>`_
  74. - Matt Luongo ~> `@mhluongo <https://github.com/mhluongo>`_
  75. - Steve Pulec ~> `@spulec <https://github.com/spulec>`_
  76. - Miro Hrončok ~> `@hroncok <https://github.com/hroncok>`_