Skip to content
Myr

Fixed #1630

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

authored by daftshady · committed by daftshady · parent 373166d · Browse files · 2 files+20 added−8 removed
This commit

State

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

Diff stats

2 files+20 added−8 removed

  • other:+20 added−8 removed

2 files+20 added−8 removed

modified:requests/cookies.py+16 added
402 unmodified lines
403 if cookie_dict is not None:404 for name in cookie_dict:405 cookiejar.set_cookie(create_cookie(name, cookie_dict[name]))406 return cookiejar407408409def merge_session_cookies(cookiejar, cookie_dict):410 """Merges cookie_dict with session CookieJar.411412 :param cookiejar: Should be session cookie.413 :param cookie_dict: Dict of key/values to be merged.414 """415 if cookiejar is None:416 cookiejar = RequestsCookieJar()417418 if cookie_dict is not None:419 for k in cookie_dict:420 # Session should not be modified by request cookie.421 if k not in [cookie.name for cookie in cookiejar]:422 cookiejar.set_cookie(create_cookie(k, cookie_dict[k]))
modified:requests/sessions.py+4 added-8 removed
11 unmodified lines
12from collections import Mapping13from datetime import datetime1415from .compat import cookielib, OrderedDict, urljoin, urlparse16from .cookies import cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar16from .cookies import cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar, merge_session_cookies17from .models import Request, PreparedRequest18from .hooks import default_hooks, dispatch_hook19from .utils import to_key_val_list, default_headers20from .exceptions import TooManyRedirects, InvalidSchema
124 unmodified lines
145 )146147 extract_cookies_to_jar(self.cookies, prepared_request, resp.raw)148149 # Restore original cookies in redirects response.150 headers = resp.request.headers151 try:152 headers['Cookie'] = req.headers['Cookie']153 except KeyError:154 pass155149 i += 1150 yield resp151152
168 unmodified lines
321 hooks = hooks,322 )323 prep = self.prepare_request(req)324325 # Add param cookies to session cookies326 merge_session_cookies(self.cookies, cookies)327328 proxies = proxies or {}329330 # Gather clues from the surrounding environment.331 if self.trust_env:
199 unmodified lines