fixed User-Agent problem for nzb.su, fixed startup failure if version wasn't detected

This commit is contained in:
Clay Mitchell 2013-02-16 15:22:41 -05:00
parent 5817ff18f6
commit e9e9d31d3a
3 changed files with 9 additions and 6 deletions

View File

@ -429,7 +429,10 @@ def initialize():
# Get the currently installed version - returns None, 'win32' or the git hash
# Also sets INSTALL_TYPE variable to 'win', 'git' or 'source'
CURRENT_VERSION = versioncheck.getVersion()
hash = CURRENT_VERSION[:7]
if CURRENT_VERSION is not None:
hash = CURRENT_VERSION[:7]
else:
hash = "unknown"
print ("hash is set to : " + str(hash))
if version.MYLAR_VERSION == 'master':

View File

@ -15,8 +15,8 @@ def searchit(cm):
logger.fdebug(u'Parsing results from <a href="%s">nzbx.co</a>' % searchURL)
request = urllib2.Request(searchURL)
request.add_header(mylar.USER_AGENT)
opener = urllib2.build_opener()
request.add_header('User-Agent', str(mylar.USER_AGENT))
opener = urllib2.build_opener(urllib2.HTTPHandler(debuglevel=1))
try:
data = opener.open(request).read()

View File

@ -347,8 +347,8 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, nzbprov, nzbpr, Is
# Add a user-agent
print ("user-agent:" + str(mylar.USER_AGENT))
request = urllib2.Request(findurl)
request.add_header('User Agent', str(mylar.USER_AGENT))
opener = urllib2.build_opener()
request.add_header('User-Agent', str(mylar.USER_AGENT))
opener = urllib2.build_opener(urllib2.HTTPHandler(debuglevel=1))
try:
data = opener.open(request).read()