1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-28 09:00:46 +02:00

- extend the 'auth_dict' to more generic per-host options 'api_host_options'

This allows in a next step to add per-host extra http-headers,
  here for special authentication purposes.
This commit is contained in:
Susanne Oberhauser
2008-08-20 09:45:49 +00:00
parent f07da13359
commit f7d2a690f5
4 changed files with 35 additions and 18 deletions

View File

@@ -23,7 +23,7 @@ def join_url(self, base_url, rel_url):
class Fetcher:
def __init__(self, cachedir = '/tmp', auth_dict = {}, urllist = [], http_debug = False):
def __init__(self, cachedir = '/tmp', api_host_options = {}, urllist = [], http_debug = False):
__version__ = '0.1'
__user_agent__ = 'osbuild/%s' % __version__
@@ -40,8 +40,8 @@ class Fetcher:
self.http_debug = http_debug
passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
for host in auth_dict.keys():
passmgr.add_password(None, host, auth_dict[host]['user'], auth_dict[host]['pass'])
for host in api_host_options.keys():
passmgr.add_password(None, host, api_host_options[host]['user'], api_host_options[host]['pass'])
authhandler = urllib2.HTTPBasicAuthHandler(passmgr)
self.gr = URLGrabber(user_agent=__user_agent__,
keepalive=1,