Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: third_party/requests/packages/urllib3/__init__.py

Issue 24076010: Add 'requests' library to third_party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/swarm_client
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # urllib3/__init__.py
2 # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
3 #
4 # This module is part of urllib3 and is released under
5 # the MIT License: http://www.opensource.org/licenses/mit-license.php
6
7 """
8 urllib3 - Thread-safe connection pooling and re-using.
9 """
10
11 __author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'
12 __license__ = 'MIT'
13 __version__ = 'dev'
14
15
16 from .connectionpool import (
17 HTTPConnectionPool,
18 HTTPSConnectionPool,
19 connection_from_url
20 )
21
22 from . import exceptions
23 from .filepost import encode_multipart_formdata
24 from .poolmanager import PoolManager, ProxyManager, proxy_from_url
25 from .response import HTTPResponse
26 from .util import make_headers, get_host
27
28
29 # Set default logging handler to avoid "No handler found" warnings.
30 import logging
31 try: # Python 2.7+
32 from logging import NullHandler
33 except ImportError:
34 class NullHandler(logging.Handler):
35 def emit(self, record):
36 pass
37
38 logging.getLogger(__name__).addHandler(NullHandler())
39
40 def add_stderr_logger(level=logging.DEBUG):
41 """
42 Helper for quickly adding a StreamHandler to the logger. Useful for
43 debugging.
44
45 Returns the handler after adding it.
46 """
47 # This method needs to be in this __init__.py to get the __name__ correct
48 # even if urllib3 is vendored within another package.
49 logger = logging.getLogger(__name__)
50 handler = logging.StreamHandler()
51 handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message) s'))
52 logger.addHandler(handler)
53 logger.setLevel(level)
54 logger.debug('Added an stderr logging handler to logger: %s' % __name__)
55 return handler
56
57 # ... Clean up.
58 del NullHandler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698