Skip to content
Myr

hmmm

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 a74e954 · Browse files · 2 files+20 added−13 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−13 removed

  • other:+20 added−13 removed

2 files+20 added−13 removed

modified:requests/core.py+7 added-6 removed
163 unmodified lines
164 req = _Request(self._build_url(self.url, self.data), method=self.method)165 else:166 if self.files:167 register_openers()168# self.files169 datagen, headers = multipart_encode(self.files)170 req = _Request(self.url, data=datagen, headers=headers, method=self.method)171 else:172 req = _Request(self.url, method=self.method)173173 if self.data:174 req.data = self.data174 if self.data:175 req.data = self.data176177 if self.headers:178 req.headers = self.headers179
219 unmodified lines
399 :param cookies: (optional) CookieJar object to send with the :class:`Request`.400 :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.401 :param auth: (optional) AuthObject to enable Basic HTTP Auth.402 """402 data = kwargs.get('data', None) or kwargs.get('params', None)403 data = kwargs.pop('data', dict()) or kwargs.pop('params', dict())404404 r = Request(method=method, url=url, data=data, headers=kwargs.get('headers', {}),405 cookiejar=kwargs.get('cookies', None), files=kwargs.get('files', None),406 auth=kwargs.get('auth', auth_manager.get_auth(url)))405 r = Request(method=method, url=url, data=data, headers=kwargs.pop('headers', {}),406 cookiejar=kwargs.pop('cookies', None), files=kwargs.pop('files', None),407 auth=kwargs.pop('auth', auth_manager.get_auth(url)))408 r.send()409410 return r.response411
81 unmodified lines
modified:test_requests.py+13 added-7 removed
61 unmodified lines
62 # reset auto authentication63 requests.auth_manager.empty()6465 def test_POSTBIN_GET_POST_FILES(self):66 h = {'Content-type': 'application/x-www-form-urlencoded'}67 66 bin = requests.get('http://www.postbin.org/')67 self.assertEqual(bin.status_code, 200)68 bin = requests.post('http://www.postbin.org/', headers=h)69 # self.assertEqual(bin.status_code, 200)70 71 print bin.url72 print bin.status_code73 69 post = requests.post(bin.url, data={'some': 'data'})70 self.assertEqual(post.status_code, 200)74 # post = requests.post(bin.url, data={'some': 'data'})75 # self.assertEqual(post.status_code, 200)76 72 post2 = requests.post(bin.url, files={'some': open('test_requests.py')})73 self.assertEqual(post2.status_code, 200)77 # post2 = requests.post(bin.url, files={'some': open('test_requests.py')})78 # self.assertEqual(post2.status_code, 200)79 80 81 def test_POSTBIN_GET_POST_FILES_WITH_PARAMS(self):82 # TODO: postbin w/ params83 bin = requests.get('http://www.postbin.org/')84 self.assertEqual(bin.status_code, 200)85 86 post = requests.post(bin.url, data={'some': 'data'})87 self.assertEqual(post.status_code, 200)88 83 # post2 = requests.post(bin.url, files={'some': open('test_requests.py')}, data={'some': 'data'})89 post2 = requests.post(bin.url, files={'some': open('test_requests.py')}, data={'some': 'data'})90 # self.assertEqual(post2.status_code, 200)9192 def test_nonzero_evaluation(self):93 r = requests.get('http://google.com/some-404-url')
22 unmodified lines