Merge branch 'fix-merge-setting' of https://github.com/ak1r4/requests into proposed/2.8.0
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Cory Benfield · committed by Cory Benfield · parents 873f834, 276202f · Browse files · 4 files·+14 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
4 files+14 added−10 removed
- other:+14 added−10 removed
Provenance
- Commit
5d7392f- Tree
fb40c33- Author
Cory Benfield <lukasaoz@gmail.com>- Committer
Cory Benfield <lukasaoz@gmail.com>- Parent 1
873f834- Parent 2
276202f
4 files changed+14 added−10 removed
modified:docs/community/faq.rst+3 added-3 removed
77 unmodified lines78 when servers are using `Virtual Hosting`_. When such servers are hosting79 more than one SSL site they need to be able to return the appropriate80 certificate based on the hostname the client is connecting to.81 82-Python3's SSL module includes native support for SNI. This support has not been83-back ported to Python2. For information on using SNI with Requests on Python284-refer to this `Stack Overflow answer`_.82+Python3 and Python 2.7.9+ include native support for SNI in their SSL modules.83+For information on using SNI with Requests on Python < 2.7.9 refer to this84+`Stack Overflow answer`_.85 86 .. _`Server-Name-Indication`: https://en.wikipedia.org/wiki/Server_Name_Indication87 .. _`virtual hosting`: https://en.wikipedia.org/wiki/Virtual_hosting88 .. _`Stack Overflow answer`: https://stackoverflow.com/questions/18578439/using-requests-with-tls-doesnt-give-sni-support/18579484#18579484modified:docs/user/quickstart.rst+3 added-4 removed
71 unmodified lines72 73 Note that any dictionary key whose value is ``None`` will not be added to the74 URL's query string.75 76-In order to pass a list of items as a value you must mark the key as77-referring to a list like string by appending ``[]`` to the key::76+You can also pass a list of items as a value::77 79- >>> payload = {'key1': 'value1', 'key2[]': ['value2', 'value3']}78+ >>> payload = {'key1': 'value1', 'key2': ['value2', 'value3']}79 >>> r = requests.get("http://httpbin.org/get", params=payload)80 >>> print(r.url)82- http://httpbin.org/get?key1=value1&key2%5B%5D=value2&key2%5B%5D=value381+ http://httpbin.org/get?key1=value1&key2=value2&key2=value382 83 Response Content84 ----------------85 386 unmodified linesmodified:requests/sessions.py+1 added-3 removed
61 unmodified lines62 merged_setting = dict_class(to_key_val_list(session_setting))63 merged_setting.update(to_key_val_list(request_setting))64 65 # Remove keys that are set to None.66- for (k, v) in request_setting.items():66+ for (k, v) in merged_setting.items():67 if v is None:68 del merged_setting[k]69 70- merged_setting = dict((k, v) for (k, v) in merged_setting.items() if v is not None)71-70 return merged_setting71 72 73 def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict):602 unmodified linesmodified:test_requests.py+7 added
128 unmodified lines129 request = requests.Request('GET',130 "http://example.com/path?key=value#fragment", params={"a": "b"}).prepare()131 assert request.url == "http://example.com/path?key=value&a=b#fragment"132 133+ def test_params_original_order_is_preserved_by_default(self):134+ param_ordered_dict = collections.OrderedDict((('z', 1), ('a', 1), ('k', 1), ('d', 1)))135+ session = requests.Session()136+ request = requests.Request('GET', 'http://example.com/', params=param_ordered_dict)137+ prep = session.prepare_request(request)138+ assert prep.url == 'http://example.com/?z=1&a=1&k=1&d=1'139+140 def test_mixed_case_scheme_acceptable(self):141 s = requests.Session()142 s.proxies = getproxies()143 parts = urlparse(httpbin('get'))1553 unmodified lines