further remove config
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kenneth Reitz · committed by Kenneth Reitz · parent 2b5aed7 · Browse files · 4 files·+19 added−28 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+19 added−28 removed
- other:+19 added−28 removed
Provenance
- Commit
cc4b0b1- Tree
c26646f- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent
2b5aed7
4 files changed+19 added−28 removed
modified:requests/adapters.py+2 added-2 removed
32 unmodified lines33 34 def __init__(self):35 super(BaseAdapter, self).__init__()36 37- # def send(self):38- # raise NotImplementedError37+ def send(self):38+ raise NotImplementedError39 40 def close(self):41 raise NotImplementedError42 132 unmodified linesmodified:requests/defaults.py-15 removed
17 unmodified lines18 :trust_env: If true, the surrouding environment will be trusted (environ, netrc).19 """20 21 SCHEMAS = ['http', 'https']22-23-from .utils import default_user_agent24-25-defaults = dict()26-27-defaults['base_headers'] = {28- 'User-Agent': default_user_agent(),29- 'Accept-Encoding': ', '.join(('gzip', 'deflate', 'compress')),30- 'Accept': '*/*'31-}32-33-# Consumed at the session level, not connection.34-defaults['max_redirects'] = 3035-defaults['trust_env'] = True36-# defaults['support_http0.9'] = Truemodified:requests/sessions.py+9 added-10 removed
10 unmodified lines11 12 from copy import deepcopy13 from .compat import cookielib14 from .cookies import cookiejar_from_dict, remove_cookie_by_name15-from .defaults import defaults15 from .models import Request16 from .hooks import dispatch_hook18-from .utils import header_expand, from_key_val_list17+from .utils import header_expand, from_key_val_list, default_headers18 from .packages.urllib3.poolmanager import PoolManager19 20 from .compat import urlparse, urljoin21 from .adapters import HTTPAdapter1 unmodified line23 from .utils import requote_uri24 25 from .status_codes import codes26 REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved)27+DEFAULT_REDIRECT_LIMIT = 3028 29 30-30 def merge_kwargs(local_kwarg, default_kwarg):31 """Merges kwarg dictionaries.32 33 If a local key in the dictionary is set to None, it will be removed.99 unmodified lines133 134 135 136 138-139-140-141-142-137 class Session(SessionMixin):138 """A Requests session."""139 140 __attrs__ = [50 unmodified lines191 192 #: SSL certificate.193 self.cert = cert194 201- for (k, v) in list(defaults.items()):202- self.config.setdefault(k, deepcopy(v))195+ #: Maximum number of redirects to follow.196+ self.max_redirects = DEFAULT_REDIRECT_LIMIT197 198+ #: Should we trust the environment199+ self.trust_env = True200+201+ self.default_headers = default_headers()202+203 # Set up a CookieJar to be used by default204 if isinstance(cookies, cookielib.CookieJar):205 self.cookies = cookies206 else:154 unmodified linesmodified:requests/utils.py+8 added-1 removed
554 unmodified lines555 elif _implementation == 'IronPython':556 _implementation_version = platform.python_version() # Complete Guess557 else:558 _implementation_version = 'Unknown'559- 559+560 try:561 p_system = platform.system()562 p_release = platform.release()563 except IOError:5 unmodified lines569 '%s/%s' % (_implementation, _implementation_version),570 '%s/%s' % (p_system, p_release),571 ])572 573+def default_headers():574+ return {575+ 'User-Agent': default_user_agent(),576+ 'Accept-Encoding': ', '.join(('gzip', 'deflate', 'compress')),577+ 'Accept': '*/*'578+ }579 580+581 def parse_header_links(value):582 """Return a dict of parsed link headers proxies.583 584 i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"63 unmodified lines