diff options
Diffstat (limited to 'requests/__init__.py')
-rw-r--r-- | requests/__init__.py | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/requests/__init__.py b/requests/__init__.py index 483ac87..7ea7e62 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -6,24 +6,51 @@ # / """ -requests -~~~~~~~~ +requests HTTP library +~~~~~~~~~~~~~~~~~~~~~ -:copyright: (c) 2012 by Kenneth Reitz. -:license: ISC, see LICENSE for more details. +Requests is an HTTP library, written in Python, for human beings. Basic GET +usage: + + >>> import requests + >>> r = requests.get('http://python.org') + >>> r.status_code + 200 + >>> 'Python is a programming language' in r.content + True + +... or POST: + + >>> payload = dict(key1='value1', key2='value2') + >>> r = requests.post("http://httpbin.org/post", data=payload) + >>> print r.text + { + ... + "form": { + "key2": "value2", + "key1": "value1" + }, + ... + } + +The other HTTP methods are supported - see `requests.api`. Full documentation +is at <http://python-requests.org>. + +:copyright: (c) 2013 by Kenneth Reitz. +:license: Apache 2.0, see LICENSE for more details. """ __title__ = 'requests' -__version__ = '0.12.1' -__build__ = 0x001201 +__version__ = '1.1.0' +__build__ = 0x010100 __author__ = 'Kenneth Reitz' -__license__ = 'ISC' -__copyright__ = 'Copyright 2012 Kenneth Reitz' +__license__ = 'Apache 2.0' +__copyright__ = 'Copyright 2013 Kenneth Reitz' from . import utils -from .models import Request, Response +from .models import Request, Response, PreparedRequest from .api import request, get, head, post, patch, put, delete, options from .sessions import session, Session from .status_codes import codes @@ -31,3 +58,14 @@ from .exceptions import ( RequestException, Timeout, URLRequired, TooManyRedirects, HTTPError, ConnectionError ) + +# Set default logging handler to avoid "No handler found" warnings. +import logging +try: # Python 2.7+ + from logging import NullHandler +except ImportError: + class NullHandler(logging.Handler): + def emit(self, record): + pass + +logging.getLogger(__name__).addHandler(NullHandler()) |