use logger instead of print in modules
This commit is contained in:
parent
d576fd19c8
commit
ca7fd3c7f2
4 changed files with 5 additions and 8 deletions
|
|
@ -33,10 +33,8 @@ class LoginPage(BasePage):
|
||||||
success_p = self.document.xpath(
|
success_p = self.document.xpath(
|
||||||
'//p[text() = "Login Successful. You will be returned momentarily."]')
|
'//p[text() = "Login Successful. You will be returned momentarily."]')
|
||||||
if len(success_p):
|
if len(success_p):
|
||||||
print 'logged on'
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
print 'not logged on'
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,7 @@ class LoginPage(BasePage):
|
||||||
msga = ''.join(msgb)
|
msga = ''.join(msgb)
|
||||||
msg = msga.strip("\n")
|
msg = msga.strip("\n")
|
||||||
|
|
||||||
if "maintenance" in msg:
|
if "maintenance" in msg:
|
||||||
print "Fortuneo: "+msg
|
|
||||||
raise BrowserUnavailable(msg)
|
raise BrowserUnavailable(msg)
|
||||||
|
|
||||||
self.browser.select_form(nr=3)
|
self.browser.select_form(nr=3)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class IndexPage(BasePage):
|
||||||
url = title.attrib['href']
|
url = title.attrib['href']
|
||||||
m = re.match('^http://www.pluzz.fr/([^/]+)\.html$', url)
|
m = re.match('^http://www.pluzz.fr/([^/]+)\.html$', url)
|
||||||
if not m:
|
if not m:
|
||||||
print ':( %s' % url
|
self.logger.debug('url %s does not match' % url)
|
||||||
continue
|
continue
|
||||||
_id = m.group(1)
|
_id = m.group(1)
|
||||||
video = PluzzVideo(_id)
|
video = PluzzVideo(_id)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class IndexPage(BasePage):
|
||||||
url = a.attrib['href']
|
url = a.attrib['href']
|
||||||
m = re.match('/video-(.*)', url)
|
m = re.match('/video-(.*)', url)
|
||||||
if not m:
|
if not m:
|
||||||
print ':( %s' % url
|
self.logger.debug('url %s does not match' % url)
|
||||||
continue
|
continue
|
||||||
_id = m.group(1)
|
_id = m.group(1)
|
||||||
video = TricTracTVVideo(_id)
|
video = TricTracTVVideo(_id)
|
||||||
|
|
@ -51,7 +51,7 @@ class IndexPage(BasePage):
|
||||||
video.rating_max = 5
|
video.rating_max = 5
|
||||||
|
|
||||||
video.thumbnail = Thumbnail ( unicode ( 'http://www.trictrac.tv/%s' % url ) )
|
video.thumbnail = Thumbnail ( unicode ( 'http://www.trictrac.tv/%s' % url ) )
|
||||||
|
|
||||||
yield video
|
yield video
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ class VideoPage(BasePage):
|
||||||
months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
|
months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
|
||||||
words = string.split ( ' ' )
|
words = string.split ( ' ' )
|
||||||
month_no = months.index ( words [ 1 ] ) + 1
|
month_no = months.index ( words [ 1 ] ) + 1
|
||||||
return datetime.datetime.strptime ( ( '%s %s %s %s' %
|
return datetime.datetime.strptime ( ( '%s %s %s %s' %
|
||||||
( words [ 0 ], month_no, words [ 2 ], words [ 3 ] ) ),
|
( words [ 0 ], month_no, words [ 2 ], words [ 3 ] ) ),
|
||||||
'%d %m %Y, %H:%M:%S')
|
'%d %m %Y, %H:%M:%S')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue