sqlite is optional with Browser
This commit is contained in:
parent
d65d551ce1
commit
19a37ccdfa
2 changed files with 16 additions and 8 deletions
|
|
@ -27,7 +27,12 @@ import time
|
||||||
from logging import warning, error
|
from logging import warning, error
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
|
||||||
from weboob.tools.firefox_cookies import FirefoxCookieJar
|
try:
|
||||||
|
from weboob.tools.firefox_cookies import FirefoxCookieJar
|
||||||
|
HAVE_COOKIES = True
|
||||||
|
except ImportError, e:
|
||||||
|
warning("Unable to store cookies: %s" % e)
|
||||||
|
HAVE_COOKIES = False
|
||||||
|
|
||||||
class BrowserIncorrectPassword(Exception):
|
class BrowserIncorrectPassword(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
@ -86,7 +91,7 @@ class Browser(mechanize.Browser):
|
||||||
]
|
]
|
||||||
|
|
||||||
# Share cookies with firefox
|
# Share cookies with firefox
|
||||||
if firefox_cookies:
|
if firefox_cookies and HAVE_COOKIES:
|
||||||
self.__cookie = FirefoxCookieJar(self.DOMAIN, firefox_cookies)
|
self.__cookie = FirefoxCookieJar(self.DOMAIN, firefox_cookies)
|
||||||
self.__cookie.load()
|
self.__cookie.load()
|
||||||
self.set_cookiejar(self.__cookie)
|
self.set_cookiejar(self.__cookie)
|
||||||
|
|
|
||||||
15
weboob2mail
15
weboob2mail
|
|
@ -29,6 +29,7 @@ import sys
|
||||||
|
|
||||||
from weboob import Weboob
|
from weboob import Weboob
|
||||||
from weboob.capabilities import CAP_MAILS
|
from weboob.capabilities import CAP_MAILS
|
||||||
|
from weboob.tools.application import BaseApplication
|
||||||
|
|
||||||
class User:
|
class User:
|
||||||
def __init__(self, username, password, email):
|
def __init__(self, username, password, email):
|
||||||
|
|
@ -36,13 +37,15 @@ class User:
|
||||||
self.password = password
|
self.password = password
|
||||||
self.email = email
|
self.email = email
|
||||||
|
|
||||||
class Application:
|
class Application(BaseApplication):
|
||||||
APPNAME = 'weboob2mail'
|
APPNAME = 'weboob2mail'
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.weboob = Weboob(self.APPNAME)
|
|
||||||
|
|
||||||
def main(self, argv):
|
def main(self, argv):
|
||||||
|
if not self.config.values:
|
||||||
|
print >>sys.stderr, "Error: %s is not configured yet. Please call 'weboob2mail -c'" % argv[0]
|
||||||
|
print >>sys.stderr, "Also, you need to use 'weboobcfg' to set backend configs"
|
||||||
|
return -1
|
||||||
|
|
||||||
self.weboob.loadmodules(CAP_MAILS)
|
self.weboob.loadmodules(CAP_MAILS)
|
||||||
|
|
||||||
self.weboob.schedule(interval, self.process)
|
self.weboob.schedule(interval, self.process)
|
||||||
|
|
@ -56,8 +59,8 @@ class Application:
|
||||||
self.send_email(m)
|
self.send_email(m)
|
||||||
|
|
||||||
def send_email(self, mail):
|
def send_email(self, mail):
|
||||||
domain = ''
|
domain = self.config.items['domain']
|
||||||
recipient = ''
|
recipient = self.config.items['recipient']
|
||||||
|
|
||||||
reply_id = ''
|
reply_id = ''
|
||||||
if mail.getReplyID():
|
if mail.getReplyID():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue