Metadata-Version: 2.0
Name: pyriform
Version: 0.5
Summary: Connect the requests library to your WSGI app without using sockets.
Home-page: https://github.com/the-allanc/pyriform/
Author: Allan Crooks
Author-email: allan@increment.one
License: MIT
Keywords: requests,wsgi
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
Requires-Python: >=2.7
Requires-Dist: requests
Requires-Dist: six
Requires-Dist: webtest
Provides-Extra: docs
Requires-Dist: allanc-sphinx[yeen] (>=0.2); extra == 'docs'
Requires-Dist: collective.checkdocs; extra == 'docs'
Requires-Dist: jaraco.packaging (>=3.2); extra == 'docs'
Requires-Dist: rst.linker (>=1.9); extra == 'docs'
Requires-Dist: sphinx; extra == 'docs'
Provides-Extra: testing
Requires-Dist: cherrypy; extra == 'testing'
Requires-Dist: httpbin; extra == 'testing'
Requires-Dist: pytest (>=2.8); extra == 'testing'
Requires-Dist: pytest-sugar; extra == 'testing'

.. _repository: https://github.com/the-allanc/pyriform/
.. _documentation: https://pyriform.readthedocs.io/en/stable/
.. _pypi: https://pypi.python.org/pypi/pyriform
.. _coveralls: https://coveralls.io/github/the-allanc/pyriform
.. _license: https://github.com/the-allanc/pyriform/master/LICENSE.txt
.. _travis: https://travis-ci.org/the-allanc/pyriform
.. _codeclimate: https://codeclimate.com/github/the-allanc/pyriform

.. |Build Status| image:: https://img.shields.io/travis/the-allanc/pyriform.svg
    :target: travis_
    :alt: Build Status
.. |Coverage| image:: https://img.shields.io/coveralls/the-allanc/pyriform.svg
    :target: coveralls_
    :alt: Coverage
.. |Docs| image:: https://readthedocs.org/projects/pyriform/badge/?version=stable&style=flat
    :target: documentation_
    :alt: Docs
.. |Release Version| image:: https://img.shields.io/pypi/pyversions/pyriform.svg
    :target: pypi_
    :alt: Release Version
.. |Python Version| image:: https://img.shields.io/pypi/v/pyriform.svg
    :target: pypi_
    :alt: Python Version
.. |License| image:: https://img.shields.io/pypi/l/pyriform.svg
    :target: license_
    :alt: License
.. |Code Climate| image:: https://img.shields.io/codeclimate/issues/github/the-allanc/pyriform.svg
    :target: codeclimate_
    :alt: Code Climate

.. _requests: http://python-requests.org
.. _webtest: https://docs.pylonsproject.org/projects/webtest/

Linking the Requests_ and WebTest_ libraries together, ``pyriform`` allows you to use the ``requests`` library to interact your WSGI app without needing to have it running on the network; it bonds these two web components together.

It's useful for testing purposes, handles all standard HTTP methods (as well as custom ones), supports request timeouts. and is both Python 2 and 3 compatible.

Example Usage
-------------

.. _cherrypy: http://www.cherrypy.org

Here's an example with a small WSGI app (in this case, using CherryPy_), and how we can use Pyriform to connect to it::

    >>> # Create the WSGI app.
    >>>
    >>> import cherrypy
    >>>
    >>> class SayHello(object):
    ...
    ...     @cherrypy.expose
    ...     def default(self, word):
    ...         return "Hello %s from %s!" % (word, cherrypy.request.headers['X-Location'])
    ...
    >>> cherrypy.config.update({'environment': 'embedded'})  # Suppress logging output.
    >>> app = cherrypy.tree.mount(SayHello(), '/')
    >>>
    >>> # Now use Pyriform to map requests from a particular URL to this app.
    >>>
    >>> import pyriform
    >>> import requests
    >>> adapter = pyriform.WSGIAdapter(app)
    >>> session = requests.Session()
    >>> session.mount('http://helloapp/', adapter)
    >>> resp = session.get('http://helloapp/World', headers={'X-Location': 'London'})
    >>> print (resp.text)
    Hello World from London!


|Docs| |Release Version| |Python Version| |License| |Build Status| |Coverage| |Code Climate|

.. all-content-above-will-be-included-in-sphinx-docs

You can browse the source code and file bug reports at the project repository_. Full documentation can be found `here`__.

__ documentation_

