Couple small code fixes

This commit is contained in:
echel0n 2014-04-27 16:03:13 -07:00
parent 28d39df816
commit 2550b8c831
2 changed files with 7 additions and 8 deletions

View file

@ -165,10 +165,10 @@ def sanitizeFileName(name):
return name return name
def getURL(url, post_data=None, headers=None, params=None, json=False): def getURL(url, post_data=None, headers=None, params=None, timeout=30, json=False):
"""
Returns a byte-string retrieved from the url provider.
""" """
Returns a byte-string retrieved from the url provider.
"""
global session global session
if not session: if not session:
@ -191,11 +191,11 @@ Returns a byte-string retrieved from the url provider.
proxies = { proxies = {
"http": sickbeard.PROXY_SETTING, "http": sickbeard.PROXY_SETTING,
"https": sickbeard.PROXY_SETTING, "https": sickbeard.PROXY_SETTING,
} }
r = session.get(url, params=params, data=post_data, headers=dict(zip(it, it)), proxies=proxies, verify=False) r = session.get(url, params=params, data=post_data, headers=dict(zip(it, it)), proxies=proxies, timeout=timeout, verify=False)
else: else:
r = session.get(url, params=params, data=post_data, headers=dict(zip(it, it)), verify=False) r = session.get(url, params=params, data=post_data, headers=dict(zip(it, it)), timeout=timeout, verify=False)
except requests.HTTPError, e: except requests.HTTPError, e:
logger.log(u"HTTP error " + str(e.errno) + " while loading URL " + url, logger.WARNING) logger.log(u"HTTP error " + str(e.errno) + " while loading URL " + url, logger.WARNING)
return None return None

View file

@ -51,8 +51,7 @@ def sendNZB(nzb, proper=False):
if nzbGetRPC.writelog("INFO", "Sickbeard connected to drop of %s any moment now." % (nzb.name + ".nzb")): if nzbGetRPC.writelog("INFO", "Sickbeard connected to drop of %s any moment now." % (nzb.name + ".nzb")):
logger.log(u"Successful connected to NZBget", logger.DEBUG) logger.log(u"Successful connected to NZBget", logger.DEBUG)
else: else:
logger.log(u"Successful connected to NZBget, but unable to send a message" % (nzb.name + ".nzb"), logger.log(u"Successful connected to NZBget, but unable to send a message", logger.ERROR)
logger.ERROR)
except httplib.socket.error: except httplib.socket.error:
logger.log( logger.log(