Пример #1
0
 def _do_action(self, action, email, tries=0):
     try:
         self.gmail_at
     except KeyError:
         self.new_token()
         try:
             self.gmail_at
         except KeyError:
             if tries < 3:
                 log.debug_s('Action %r being retried', action)
                 return call_later(2, self._do_action, action, email, tries+1)
     url, params = self._actionUrl(action, email.id)
     response = self.webrequest(url, **params)
     log.debug_s('Action %r result: %r', action, response)
Пример #2
0
 def check_error(self, ret, *a):
     log.info("check_error: %r, %r", ret, a)
     if isinstance(ret, FacebookError):
         from .facebookprotocol import not_logged_in
         if not_logged_in(ret):
             log.info_s('not logged in: api: %r, session: %r', self.api.name, self.api.session_key)
             return self.not_logged_in(ret)
     self.errcount += 1
     if self.errcount >= self.max_errcount:
         return self.callback.error(ret)
     if self.api.mode == 'async':
         return call_later(1, self.check, callback = self.callback)
     else:
         return self.check(callback = self.callback)
Пример #3
0
 def check_error(self, ret, *a):
     log.info("check_error: %r, %r", ret, a)
     if isinstance(ret, FacebookError):
         from .facebookprotocol import not_logged_in
         if not_logged_in(ret):
             log.info_s('not logged in: api: %r, session: %r',
                        self.api.name, self.api.session_key)
             return self.not_logged_in(ret)
     self.errcount += 1
     if self.errcount >= self.max_errcount:
         return self.callback.error(ret)
     if self.api.mode == 'async':
         return call_later(1, self.check, callback=self.callback)
     else:
         return self.check(callback=self.callback)
Пример #4
0
 def _do_action(self, action, email, tries=0):
     try:
         self.gmail_at
     except KeyError:
         self.new_token()
         try:
             self.gmail_at
         except KeyError:
             if tries < 3:
                 log.debug_s('Action %r being retried', action)
                 return call_later(2, self._do_action, action, email,
                                   tries + 1)
     url, params = self._actionUrl(action, email.id)
     response = self.webrequest(url, **params)
     log.debug_s('Action %r result: %r', action, response)