Metadata-Version: 2.1
Name: opencensus-ext-requests
Version: 0.7.3
Summary: OpenCensus Requests Integration
Home-page: https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-requests
Author: OpenCensus Authors
Author-email: census-developers@googlegroups.com
License: Apache-2.0
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Dist: opencensus (<1.0.0,>=0.7.3)
Requires-Dist: wrapt (<2.0.0,>=1.0.0)

OpenCensus requests Integration
============================================================================

|pypi|

.. |pypi| image:: https://badge.fury.io/py/opencensus-ext-requests.svg
   :target: https://pypi.org/project/opencensus-ext-requests/

OpenCensus can trace HTTP requests made with the `requests package`_. The request URL,
method, and status will be collected.

You can enable requests integration by specifying ``'requests'`` to ``trace_integrations``.

It's possible to configure a list of URL you don't want traced. By default the request to exporter
won't be traced. It's configurable by giving an array of hostname/port to the attribute
``blacklist_hostnames`` in OpenCensus context's attributes:

Only the hostname must be specified if only the hostname is specified in the URL request.

.. _Requests package: https://pypi.python.org/pypi/requests

Installation
------------

::

    pip install opencensus-ext-requests

Usage
-----

.. code:: python

    import requests
    from opencensus.trace import config_integration
    from opencensus.trace.tracer import Tracer

    if __name__ == '__main__':
        config_integration.trace_integrations(['requests'])
        tracer = Tracer()
        with tracer.span(name='parent'):
            response = requests.get(url='https://www.wikipedia.org/wiki/Rabbit')

References
----------

* `OpenCensus Project <https://opencensus.io/>`_


