Commits

Andriy Kornatskyy  committed ab7873c

Added httpclient section to userguide.

  • Participants
  • Parent commits 68d03d5

Comments (0)

Files changed (2)

File doc/userguide.rst

       100.0%     839rps  +0.0% test_home
        96.2%     807rps  +3.9% test_about
 
-Each of the test cases has been run 1000 times. The shows productivity 
+Each of the test cases has been run 1000 times. The shows productivity
 relative to the first test case (which serves as a baseline for other tests), throughput
 in requests per second, change from ``baselines`` argument passed to
 ``report`` method and target being benchmarked.
     >>> total_seconds(timedelta(hours=2))
     7200
 
+httpclient
+----------
+
+:py:class:`~wheezy.core.httpclient.HTTPClient` sends HTTP requests to a
+server in order to accomplish an application specific use cases,
+e.g. remote web server API, etc::
+
+    >>> from wheezy.core.httpclient import HTTPClient
+    >>> client = HTTPClient('http://buildbot.buildbot.net/json/')
+    >>> client.get('project')
+    200
+    >>> project = client.json
+    >>>> str(project.title)
+    Buildbot
+
 i18n
 ----
 
 
 * :py:meth:`~wheezy.core.json.json_encode` encodes ``obj`` as a JSON formatted
   string. Correctly escapes forward slashes to be able to embed javascript code.
-  Decimal objects are converted to string (same applies when used with 
+  Decimal objects are converted to string (same applies when used with
   ``simplejson``).
 * :py:meth:`~wheezy.core.json.json_decode` decodes a JSON document to a Python
   object. Float is parsed as Decimal.

File src/wheezy/core/httpclient.py

 
 
 class HTTPClient(object):
+    """ HTTP client sends HTTP requests to server in order to accomplish
+        an application specific use cases, e.g. remote web server API, etc.
+    """
 
     def __init__(self, url, headers=None):
-        """ HTTP client sends HTTP requests to server in order to accomplish
-            application specific use cases, e.g. remote web server API, etc.
+        """
+            `url` - a base url for interaction with remote server.
+            `headers` - a dictionary of headers.
         """
         r = urlparse(url)
         self.connection = HTTPConnection(r[1])  # netloc