Skip to content
Myr

forced_basic default handler.

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 30d699b · Browse files · 1 file+9 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

1 file+9 added−3 removed

  • other:+9 added−3 removed

1 file+9 added−3 removed

modified:requests/models.py+9 added-3 removed
14 unmodified lines
15from urlparse import urlparse, urlunparse16from datetime import datetime1718from .config import settings19from .monkeys import Request as _Request, HTTPBasicAuthHandler, HTTPDigestAuthHandler, HTTPRedirectHandler19from .monkeys import Request as _Request, HTTPBasicAuthHandler, HTTPForcedBasicAuthHandler, HTTPDigestAuthHandler, HTTPRedirectHandler20from .structures import CaseInsensitiveDict21from .packages.poster.encode import multipart_encode22from .packages.poster.streaminghttp import register_openers, get_handlers23from .exceptions import RequestException, AuthenticationError, Timeout, URLRequired, InvalidMethod
55 unmodified lines
79 self.cookiejar = cookiejar80 #: True if Request has been sent.81 self.sent = False8283 headers = settings.base_headers84 if self.headers:85 headers.update(self.headers)86 self.headers = headers878889 def __repr__(self):90 return '<Request [%s]>' % (self.method)9192
445 unmodified lines
538 """539540 _handlers = {541 'basic': HTTPBasicAuthHandler,542 'forced_basic': HTTPForcedBasicAuthHandler,543 'digest': HTTPDigestAuthHandler,544 'proxy_basic': urllib2.ProxyBasicAuthHandler,545 'proxy_digest': urllib2.ProxyDigestAuthHandler546 }547542 def __init__(self, username, password, handler='basic', realm=None):548 def __init__(self, username, password, handler='forced_basic', realm=None):549 self.username = username550 self.password = password551 self.realm = realm552553 if isinstance(handler, basestring):548 self.handler = self._handlers.get(handler.lower(), HTTPBasicAuthHandler)554 self.handler = self._handlers.get(handler.lower(), HTTPForcedBasicAuthHandler)555 else:556 self.handler = handler