Skip to content
Myr

__init__.py

This file

Path

requests/__init__.py

71 lines · 1.6 KiB · Python

Last changed by

v1.1.0 and docsKenneth Reitzbefore adoption41687c8

History of this file

Take it

1# -*- coding: utf-8 -*-23#   __4#  /__)  _  _     _   _ _/   _5# / (   (- (/ (/ (- _)  /  _)6#          /78"""9requests HTTP library10~~~~~~~~~~~~~~~~~~~~~1112Requests is an HTTP library, written in Python, for human beings. Basic GET13usage:1415   >>> import requests16   >>> r = requests.get('http://python.org')17   >>> r.status_code18   20019   >>> 'Python is a programming language' in r.content20   True2122... or POST:2324   >>> payload = dict(key1='value1', key2='value2')25   >>> r = requests.post("http://httpbin.org/post", data=payload)26   >>> print r.text27   {28     ...29     "form": {30       "key2": "value2",31       "key1": "value1"32     },33     ...34   }3536The other HTTP methods are supported - see `requests.api`. Full documentation37is at <http://python-requests.org>.3839:copyright: (c) 2013 by Kenneth Reitz.40:license: Apache 2.0, see LICENSE for more details.4142"""4344__title__ = 'requests'45__version__ = '1.1.0'46__build__ = 0x01010047__author__ = 'Kenneth Reitz'48__license__ = 'Apache 2.0'49__copyright__ = 'Copyright 2013 Kenneth Reitz'505152from . import utils53from .models import Request, Response, PreparedRequest54from .api import request, get, head, post, patch, put, delete, options55from .sessions import session, Session56from .status_codes import codes57from .exceptions import (58    RequestException, Timeout, URLRequired,59    TooManyRedirects, HTTPError, ConnectionError60)6162# Set default logging handler to avoid "No handler found" warnings.63import logging64try:  # Python 2.7+65    from logging import NullHandler66except ImportError:67    class NullHandler(logging.Handler):68        def emit(self, record):69            pass7071logging.getLogger(__name__).addHandler(NullHandler())