Skip to content
Myr

Merge branch 'develop' of https://github.com/robmadole/requests into develop

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 · parents 1d021c5, e4c690e · Browse files · 3 files+21 added−4 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+21 added−4 removed

  • other:+21 added−4 removed

3 files+21 added−4 removed

modified:requests/core.py+9 added-3 removed
109 unmodified lines
110 """Creates appropriate opener object for urllib2."""111112 _handlers = []113114 if self.cookiejar != None:115 _handlers.append(urllib2.HTTPCookieProcessor(self.cookiejar))116117 if self.auth:118 if not isinstance(self.auth.handler, (urllib2.AbstractBasicAuthHandler, urllib2.AbstractDigestAuthHandler)):119 auth_manager.add_password(self.auth.realm, self.url, self.auth.username, self.auth.password)120 self.auth.handler = self.auth.handler(auth_manager)121 auth_manager.add_auth(self.url, self.auth)122123 _handlers.append(self.auth.handler)124125 if _handlers:126 _handlers.extend(get_handlers())127 opener = urllib2.build_opener(*_handlers)128 return opener.open129 else:
56 unmodified lines
186187 if not self.sent or anyway:188 try:189 opener = self._get_opener()186 resp = opener(req)190 resp = opener(req)191192 if self.cookiejar != None:193 self.cookiejar.extract_cookies(resp, req)194 except urllib2.HTTPError, why:195 self._build_response(why)196 self.response.error = why197 else:
3 unmodified lines
201 self.response.cached = False202 else:203 self.response.cached = True204198205 self.sent = self.response.ok206207 return self.sent208
202 unmodified lines
411 """412 data = kwargs.pop('data', dict()) or kwargs.pop('params', dict())413414 r = Request(method=method, url=url, data=data, headers=kwargs.pop('headers', {}),409 cookiejar=kwargs.pop('cookies', None), files=kwargs.pop('files', None),415 cookiejar=kwargs.pop('cookiejar', None), files=kwargs.pop('files', None),416 auth=kwargs.pop('auth', auth_manager.get_auth(url)))417 r.send()418419 return r.response
82 unmodified lines
modified:.gitignore+2 added-1 removed
1.idea2MANIFEST3coverage.xml4nosetests.xml5pylint.txt5pylint.txt6*.pyc
modified:test_requests.py+10 added
1#!/usr/bin/env python2# -*- coding: utf-8 -*-34import unittest5import cookielib67import requests89
104 unmodified lines
114 r = requests.get('http://google.com/')115 self.assertFalse(r.error)116 r.raise_for_status()117 118 def test_cookie_jar(self):119 """120 .. todo:: This really doesn't test to make sure the cookie is working121 """122 jar = cookielib.CookieJar()123 self.assertFalse(jar)124125 requests.get('http://google.com', cookies=jar)126 self.assertTrue(jar)127128129130if __name__ == '__main__':131 unittest.main()