Skip to content
Myr

AuthAuths

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 d8b1957 · Browse files · 1 file+43 added−5 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+43 added−5 removed

  • other:+43 added−5 removed

1 file+43 added−5 removed

modified:requests/core.py+43 added-5 removed
7 unmodified lines
89 :copyright: (c) 2011 by Kenneth Reitz.10 :license: ISC, see LICENSE for more details.11"""12import urllib13import urllib2141516__title__ = 'convore'
3 unmodified lines
20__license__ = 'ISC'21__copyright__ = 'Copyright 2011 Kenneth Reitz'222324AUTHOAUTHS = []252627class Request(object):28 """The :class:`Request` object. It's awesome.29 """26 pass30 31 _METHODS = ('get', 'put', 'post', 'delete')32 33 def __init__(self):34 self.headers = dict()35 self.method = None36 self.response = None37 38 def __setattr__(self, key, val):39 if key == 'method':40 if not val.lower() in _METHODS:41 raise InvalidMethod()42 43 def send(self):44 pass45 set self.response()46 # return True / False47 48 49class Response(object):50 """The :class:`Request` object. It's awesome.51 """52 53 def __init__(self):54 self.content = None55 self.status_code = None56 self.headers = dict()57 58 59class AuthObject(object):60 """The :class:`AuthObject` is a simple HTTP Authentication token.61 62 :param username: Username to authenticate with.
4 unmodified lines
67 self.username = username68 self.password = password697045def get():71def get(url, params={}, headers={}, auth=None):72 pass7348def post():74def head(url, params={}, headers={}, auth=None):75 pass7677def post(url, params={}, headers={}, auth=None):78 pass79 51def put():80def put(url, data='', headers={}, auth=None):81 pass82 54def delete():83def delete(url, params={}, headers={}, auth=None):84 pass858687def add_autoauth(url, authobject):88 global AUTHOAUTHS89 90 AUTHOAUTHS.append((url, authobject))91 92 93class InvalidMethod(Exception):94 """An innappropriate method was attempted."""