Skip to content
Myr

moved logic to Session object and added test case

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

authored by daftshady · committed by daftshady · parent 495f873 · Browse files · 3 files+11 added−3 removed
This commit

State

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

Diff stats

3 files+11 added−3 removed

  • other:+11 added−3 removed

3 files+11 added−3 removed

modified:requests/api.py+2 added-2 removed
10 unmodified lines
1112"""1314from . import sessions15from .compat import builtin_str151617def request(method, url, **kwargs):18 """Constructs and sends a :class:`Request <Request>`.19 Returns :class:`Response <Response>` object.20
19 unmodified lines
40 <Response [200]>41 """4243 session = sessions.Session()44 return session.request(method=builtin_str(method), url=url, **kwargs)44 return session.request(method=method, url=url, **kwargs)454647def get(url, **kwargs):48 """Sends a GET request. Returns :class:`Response` object.
72 unmodified lines
modified:requests/sessions.py+4 added-1 removed
10 unmodified lines
11import os12from collections import Mapping13from datetime import datetime1415from .compat import cookielib, OrderedDict, urljoin, urlparse, urlunparse15from .compat import cookielib, OrderedDict, urljoin, urlparse, urlunparse, builtin_str16from .cookies import cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar17from .models import Request, PreparedRequest18from .hooks import default_hooks, dispatch_hook19from .utils import to_key_val_list, default_headers
288 unmodified lines
308 A CA_BUNDLE path can also be provided.309 :param cert: (optional) if String, path to ssl client cert file (.pem).310 If Tuple, ('cert', 'key') pair.311 """312313 method = builtin_str(method)314315 # Create the Request.316 req = Request(317 method = method.upper(),318 url = url,
216 unmodified lines
modified:test_requests.py+5 added
431 unmodified lines
432 open(filename, 'rb'))})433 prep = r.prepare()434 assert b'name="stuff"' in prep.body435 assert b'name="b\'stuff\'"' not in prep.body436 437 def test_unicode_method_name(self):438 files = {'file': open('test_requests.py', 'rb')}439 r = requests.request(method=u'POST', url=httpbin('post'), files=files)440 assert r.status_code == 200441442 def test_custom_content_type(self):443 r = requests.post(httpbin('post'),444 data={'stuff': json.dumps({'a': 123})},
446 unmodified lines