diff options
author | ardi69 <armin@diedering.de> | 2015-04-16 22:33:28 +0200 |
---|---|---|
committer | ardi69 <armin@diedering.de> | 2015-04-16 22:33:28 +0200 |
commit | 21c2ac71d045ae50a705d8ab0ac1e960d462e001 (patch) | |
tree | 896ff1eaae9151d83be150735c96a37a61d2d038 /pyload/network/RequestFactory.py | |
parent | fixed: more typos (diff) | |
parent | Merge pull request #5 from ardi69/0.4.10 (diff) | |
download | pyload-21c2ac71d045ae50a705d8ab0ac1e960d462e001.tar.xz |
Merge pull request #2 from vuolter/0.4.10
merge from vuolter
Diffstat (limited to 'pyload/network/RequestFactory.py')
-rw-r--r-- | pyload/network/RequestFactory.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/pyload/network/RequestFactory.py b/pyload/network/RequestFactory.py index 5f8e7e206..a80882088 100644 --- a/pyload/network/RequestFactory.py +++ b/pyload/network/RequestFactory.py @@ -21,7 +21,7 @@ class RequestFactory(object): def iface(self): - return self.core.config["download"]["interface"] + return self.core.config.get("download", "interface") def getRequest(self, pluginName, account=None, type="HTTP"): @@ -45,7 +45,7 @@ class RequestFactory(object): def getHTTPRequest(self, **kwargs): """ returns a http request, dont forget to close it ! """ options = self.getOptions() - options.update(kwargs) # submit kwargs as additional options + options.update(kwargs) #: submit kwargs as additional options return HTTPRequest(CookieJar(None), options) @@ -82,26 +82,26 @@ class RequestFactory(object): def getProxies(self): """ returns a proxy list for the request classes """ - if not self.core.config["proxy"]["proxy"]: + if not self.core.config.get("proxy", "proxy"): return {} else: type = "http" - setting = self.core.config["proxy"]["type"].lower() + setting = self.core.config.get("proxy", "type").lower() if setting == "socks4": type = "socks4" elif setting == "socks5": type = "socks5" username = None - if self.core.config["proxy"]["username"] and self.core.config["proxy"]["username"].lower() != "none": - username = self.core.config["proxy"]["username"] + if self.core.config.get("proxy", "username") and self.core.config.get("proxy", "username").lower() != "none": + username = self.core.config.get("proxy", "username") pw = None - if self.core.config["proxy"]["password"] and self.core.config["proxy"]["password"].lower() != "none": - pw = self.core.config["proxy"]["password"] + if self.core.config.get("proxy", "password") and self.core.config.get("proxy", "password").lower() != "none": + pw = self.core.config.get("proxy", "password") return { "type": type, - "address": self.core.config["proxy"]["address"], - "port": self.core.config["proxy"]["port"], + "address": self.core.config.get("proxy", "address"), + "port": self.core.config.get("proxy", "port"), "username": username, "password": pw, } @@ -111,15 +111,15 @@ class RequestFactory(object): """returns options needed for pycurl""" return {"interface": self.iface(), "proxies": self.getProxies(), - "ipv6": self.core.config["download"]["ipv6"]} + "ipv6": self.core.config.get("download", "ipv6")} def updateBucket(self): """ set values in the bucket according to settings""" - if not self.core.config["download"]["limit_speed"]: + if not self.core.config.get("download", "limit_speed"): self.bucket.setRate(-1) else: - self.bucket.setRate(self.core.config["download"]["max_speed"] * 1024) + self.bucket.setRate(self.core.config.get("download", "max_speed") * 1024) # needs pyreq in global namespace def getURL(*args, **kwargs): |