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

Side by Side Diff: third_party/google-endpoints/requests/__init__.py

Issue 2666783008: Add google-endpoints to third_party/. (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
(Empty)
1 # -*- coding: utf-8 -*-
2
3 # __
4 # /__) _ _ _ _ _/ _
5 # / ( (- (/ (/ (- _) / _)
6 # /
7
8 """
9 Requests HTTP library
10 ~~~~~~~~~~~~~~~~~~~~~
11
12 Requests is an HTTP library, written in Python, for human beings. Basic GET
13 usage:
14
15 >>> import requests
16 >>> r = requests.get('https://www.python.org')
17 >>> r.status_code
18 200
19 >>> 'Python is a programming language' in r.content
20 True
21
22 ... or POST:
23
24 >>> payload = dict(key1='value1', key2='value2')
25 >>> r = requests.post('http://httpbin.org/post', data=payload)
26 >>> print(r.text)
27 {
28 ...
29 "form": {
30 "key2": "value2",
31 "key1": "value1"
32 },
33 ...
34 }
35
36 The other HTTP methods are supported - see `requests.api`. Full documentation
37 is at <http://python-requests.org>.
38
39 :copyright: (c) 2016 by Kenneth Reitz.
40 :license: Apache 2.0, see LICENSE for more details.
41 """
42
43 __title__ = 'requests'
44 __version__ = '2.13.0'
45 __build__ = 0x021300
46 __author__ = 'Kenneth Reitz'
47 __license__ = 'Apache 2.0'
48 __copyright__ = 'Copyright 2016 Kenneth Reitz'
49
50 # Attempt to enable urllib3's SNI support, if possible
51 try:
52 from .packages.urllib3.contrib import pyopenssl
53 pyopenssl.inject_into_urllib3()
54 except ImportError:
55 pass
56
57 import warnings
58
59 # urllib3's DependencyWarnings should be silenced.
60 from .packages.urllib3.exceptions import DependencyWarning
61 warnings.simplefilter('ignore', DependencyWarning)
62
63 from . import utils
64 from .models import Request, Response, PreparedRequest
65 from .api import request, get, head, post, patch, put, delete, options
66 from .sessions import session, Session
67 from .status_codes import codes
68 from .exceptions import (
69 RequestException, Timeout, URLRequired,
70 TooManyRedirects, HTTPError, ConnectionError,
71 FileModeWarning, ConnectTimeout, ReadTimeout
72 )
73
74 # Set default logging handler to avoid "No handler found" warnings.
75 import logging
76 try: # Python 2.7+
77 from logging import NullHandler
78 except ImportError:
79 class NullHandler(logging.Handler):
80 def emit(self, record):
81 pass
82
83 logging.getLogger(__name__).addHandler(NullHandler())
84
85 # FileModeWarnings go off per the default.
86 warnings.simplefilter('default', FileModeWarning, append=True)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698