Skip to content
Myr

dict(o or [])

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 0f2dcff · Browse files · 1 file+25 added−23 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+25 added−23 removed

  • other:+25 added−23 removed

1 file+25 added−23 removed

modified:requests/models.py+25 added-23 removed
59 unmodified lines
60 #: Request URL.61 self.url = url6263 #: Dictionary of HTTP Headers to attach to the :class:`Request <Request>`.64 self.headers = headers64 self.headers = dict(headers or [])6566 #: Dictionary of files to multipart upload (``{filename: content}``).67 self.files = files68
15 unmodified lines
84 #: Set to True if full redirects are allowed (e.g. re-POST-ing of data at new ``Location``)85 self.allow_redirects = allow_redirects8687 # Dictionary mapping protocol to the URL of the proxy (e.g. {'http': 'foo.bar:3128'})88 self.proxies = proxies88 self.proxies = dict(proxies or [])8990 self.data, self._enc_data = self._encode_params(data)91 self.params, self._enc_params = self._encode_params(params)92
5 unmodified lines
98 self._auth = auth99 self.auth = auth_dispatch(auth)100101 #: CookieJar to attach to :class:`Request <Request>`.102 self.cookies = cookies102 self.cookies = dict(cookies or [])103104 #: Dictionary of configurations for this request.105 self.config = config105 self.config = dict(config or [])106107 #: True if Request has been sent.108 self.sent = False109
33 unmodified lines
143144 # Pass settings over.145 response.config = self.config146147 # Fallback to None if there's no staus_code, for whatever reason.148 response.status_code = getattr(resp, 'status', None)147 if resp:148150 # Make headers case-insensitive.151 response.headers = CaseInsensitiveDict(getattr(resp, 'headers', None))149 # Fallback to None if there's no staus_code, for whatever reason.150 response.status_code = getattr(resp, 'status', None)151153 # Start off with our local cookies.154 cookies = self.cookies or dict()152 # Make headers case-insensitive.153 response.headers = CaseInsensitiveDict(getattr(resp, 'headers', None))154156 # Add new cookies from the server.157 if 'set-cookie' in response.headers:158 cookie_header = response.headers['set-cookie']155 # Start off with our local cookies.156 cookies = self.cookies or dict()157160 c = SimpleCookie()161 c.load(cookie_header)158 # Add new cookies from the server.159 if 'set-cookie' in response.headers:160 cookie_header = response.headers['set-cookie']161163 for k,v in c.items():164 cookies.update({k: v.value})162 c = SimpleCookie()163 c.load(cookie_header)164166 # Save cookies in Response.167 response.cookies = cookies165 for k,v in c.items():166 cookies.update({k: v.value})167168 # Save cookies in Response.169 response.cookies = cookies170171 # Save original resopnse for later.172 response.raw = resp173174 if is_error:
209 unmodified lines
384 decode_content=False,385 retries=self.config.get('max_retries', 0)386 )387 except MaxRetryError, e:386 if self.config.get('safe_mode', False):387 pass388 raise ConnectionError(e)388 if not self.config.get('safe_mode', False):389 raise ConnectionError(e)390 else:391 r = None392390393 self._build_response(r)394395 # Response manipulation hook.396 self.response = dispatch_hook('response', self.hooks, self.response)
152 unmodified lines