mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 05:33:37 +00:00
Couple small code fixes
This commit is contained in:
parent
28d39df816
commit
2550b8c831
2 changed files with 7 additions and 8 deletions
|
@ -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:
|
||||||
|
@ -193,9 +193,9 @@ Returns a byte-string retrieved from the url provider.
|
||||||
"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
|
||||||
|
|
|
@ -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(
|
||||||
|
|
Loading…
Reference in a new issue