Skip to content
Myr

cookiejar => cookies in models

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 d72d116 · Browse files · 1 file+10 added−10 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+10 added−10 removed

  • other:+10 added−10 removed

1 file+10 added−10 removed

modified:requests/models.py+10 added-10 removed
22 unmodified lines
23from .packages.poster.encode import multipart_encode24from .packages.poster.streaminghttp import register_openers, get_handlers25from .utils import dict_from_cookiejar, get_unicode_from_response, stream_decode_response_unicode, decode_gzip, stream_decode_gzip26from .status_codes import codes27from .exceptions import RequestException, AuthenticationError, Timeout, URLRequired, InvalidMethod, TooManyRedirects27from .exceptions import Timeout, URLRequired, TooManyRedirects282930REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved)31
5 unmodified lines
37 """3839 def __init__(self,40 url=None, headers=dict(), files=None, method=None, data=dict(),41 params=dict(), auth=None, cookiejar=None, timeout=None, redirect=False,41 params=dict(), auth=None, cookies=None, timeout=None, redirect=False,42 allow_redirects=False, proxies=None, hooks=None):4344 #: Float describes the timeout of the request.45 # (Use socket.setdefaulttimeout() as fallback)
44 unmodified lines
90 #: :class:`AuthObject` to attach to :class:`Request <Request>`.91 self.auth = auth9293 #: CookieJar to attach to :class:`Request <Request>`.94 self.cookiejar = cookiejar94 self.cookies = cookies9596 #: True if Request has been sent.97 self.sent = False98
32 unmodified lines
131 """Creates appropriate opener object for urllib2."""132133 _handlers = []134135 if self.cookiejar is not None:136 _handlers.append(urllib2.HTTPCookieProcessor(self.cookiejar))135 if self.cookies is not None:136 _handlers.append(urllib2.HTTPCookieProcessor(self.cookies))137138 if self.auth:139 if not isinstance(self.auth.handler,140 (urllib2.AbstractBasicAuthHandler,
49 unmodified lines
190 try:191 response.headers = CaseInsensitiveDict(getattr(resp.info(), 'dict', None))192 response.raw = resp193194 if self.cookiejar:195 response.cookies = dict_from_cookiejar(self.cookiejar)194 if self.cookies:195 response.cookies = dict_from_cookiejar(self.cookies)196197198 except AttributeError:199 pass
43 unmodified lines
243 method = self.method244245 request = Request(246 url, self.headers, self.files, method,247 self.data, self.params, self.auth, self.cookiejar,247 self.data, self.params, self.auth, self.cookies,248 redirect=True249 )250 request.send()251 r = request.response
111 unmodified lines
363 if settings.timeout_fallback:364 # restore global timeout365 socket.setdefaulttimeout(old_timeout)366367 if self.cookiejar is not None:368 self.cookiejar.extract_cookies(resp, req)367 if self.cookies is not None:368 self.cookies.extract_cookies(resp, req)369370 except (urllib2.HTTPError, urllib2.URLError), why:371 if hasattr(why, 'reason'):372 if isinstance(why.reason, socket.timeout):
307 unmodified lines