def __init__(self, pakfire, *args, **kwargs): kwargs.update({ "quote" : 0, "user_agent" : "pakfire/%s" % PAKFIRE_VERSION, "ssl_verify_host" : False, "ssl_verify_peer" : False, }) if isinstance(pakfire, _Config): config = pakfire else: config = pakfire.config self.config = config # Set throttle setting. bandwidth_throttle = config.get("downloader", "bandwidth_throttle") if bandwidth_throttle: try: bandwidth_throttle = int(bandwidth_throttle) except ValueError: log.error("Configuration value for bandwidth_throttle is invalid.") bandwidth_throttle = 0 kwargs.update({ "throttle" : bandwidth_throttle }) # Configure HTTP proxy. http_proxy = config.get("downloader", "http_proxy") if http_proxy: kwargs.update({ "proxies" : { "http" : http_proxy, "https" : http_proxy }}) URLGrabber.__init__(self, *args, **kwargs)
def __init__(self, awsAccessKey, awsSecretKey, baseurl): self.logger = logging.getLogger("yum.verbose.main") self.logger.log(logginglevels.DEBUG_4, "s3: creating empty URLGrabber instance") URLGrabber.__init__(self) self.logger.log(logginglevels.DEBUG_4, "s3: BotoGrabber init BASE_URL=%s" % baseurl) if not baseurl: raise Exception("s3: BotoGrabberInit got blank baseurl") try: baseurl = baseurl[0] except: pass self.s3 = boto.connect_s3(awsAccessKey, awsSecretKey) self.baseurl = urlparse(baseurl) if hasattr(self.baseurl, 'netloc'): self.bucket_name = self.baseurl.netloc self.key_prefix = self.baseurl.path[1:] else: self.bucket_name = self.baseurl[1] self.key_prefix = self.baseurl[2] if self.key_prefix.startswith("/"): self.key_prefix = self.key_prefix[1:] m = re.match('(.*)\.s3.*\.amazonaws\.com', self.bucket_name) if (m): self.bucket_name = m.group(1) if sys.stdout.isatty(): print "%s - %s" % (self.bucket_name, self.key_prefix)
def __init__(self, awsAccessKey, awsSecretKey, baseurl): self.logger.debug("BotoGrabber init BASE_URL=%s" % baseurl) URLGrabber.__init__(self) self._handle_baseurl(baseurl) self._handle_s3(awsAccessKey, awsSecretKey) self._dump_attributes() interactive_notify("%s - %s" % (self.bucket_name, self.key_prefix))
def __init__(self, awsAccessKey, awsSecretKey, baseurl): if self.DEBUG: print "creating empty URLGrabber instance" URLGrabber.__init__(self) if self.DEBUG: print "BotoGrabber init BASE_URL=%s" % baseurl if not baseurl: raise Exception("BotoGrabberInit got blank baseurl") try: baseurl = baseurl[0] except: pass self.s3 = boto.connect_s3(awsAccessKey, awsSecretKey) self.baseurl = urlparse(baseurl) if hasattr(self.baseurl, 'netloc'): self.bucket_name = self.baseurl.netloc self.key_prefix = self.baseurl.path[1:] else: self.bucket_name = self.baseurl[1] self.key_prefix = self.baseurl[2] m = re.match('(.*)\.s3.*\.amazonaws\.com', self.bucket_name) if (m): self.bucket_name = m.group(1) if sys.stdout.isatty(): print "%s - %s" % (self.bucket_name, self.key_prefix)
def __init__(self, progress_obj=None): # we cannot use super because we still have to support # older urlgrabber versions where URLGrabber is an old-style class URLGrabber.__init__(self) self.progress_obj = progress_obj