implement get_account_status()
This commit is contained in:
parent
88a899e8b3
commit
bc4624d7e3
2 changed files with 13 additions and 1 deletions
|
|
@ -91,6 +91,7 @@ class PlayMeBrowser(DomainBrowser):
|
|||
|
||||
self.my_id = me['id']
|
||||
self.my_name = me['name']
|
||||
self.credits = me['credits']['count']
|
||||
|
||||
def get_threads(self):
|
||||
return reversed(self.request('/users/%s/contacts' % self.my_id))
|
||||
|
|
@ -127,9 +128,11 @@ class PlayMeBrowser(DomainBrowser):
|
|||
r = self.request('/users/%s/challenge/%s' % (self.my_id, user_id))
|
||||
except ClientError as e:
|
||||
r = json.loads(e.response.content)
|
||||
self.credits = r['credits']['count']
|
||||
raise NoCredits(r['credits']['next_restore_in_seconds'])
|
||||
|
||||
t = self.get_theme()
|
||||
self.credits = r['credits']['count']
|
||||
|
||||
data = {}
|
||||
data['theme'] = {'id': t['theme']['id'], 'is_vip': 0}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import datetime
|
|||
|
||||
from weboob.capabilities.messages import CapMessages, CapMessagesPost, Thread, Message
|
||||
from weboob.capabilities.dating import CapDating, Optimization
|
||||
from weboob.capabilities.account import CapAccount, StatusField
|
||||
from weboob.tools.backend import Module, BackendConfig
|
||||
from weboob.tools.value import Value, ValueBackendPassword
|
||||
from weboob.tools.date import local2utc
|
||||
|
|
@ -81,7 +82,7 @@ class ProfilesWalker(Optimization):
|
|||
self._view_cron = self._sched.schedule(delay, self.view_profile)
|
||||
|
||||
|
||||
class PlayMeModule(Module, CapMessages, CapMessagesPost, CapDating):
|
||||
class PlayMeModule(Module, CapMessages, CapMessagesPost, CapDating, CapAccount):
|
||||
NAME = 'playme'
|
||||
DESCRIPTION = u'PlayMe dating mobile application'
|
||||
MAINTAINER = u'Roger Philibert'
|
||||
|
|
@ -191,5 +192,13 @@ class PlayMeModule(Module, CapMessages, CapMessagesPost, CapDating):
|
|||
def post_message(self, message):
|
||||
self.browser.post_message(message.thread.id, message.content)
|
||||
|
||||
# ---- CapAccount methods ---------------------
|
||||
|
||||
def get_account_status(self):
|
||||
return (
|
||||
StatusField(u'myname', u'My name', unicode(self.browser.my_name)),
|
||||
StatusField(u'credits', u'Credits', unicode(self.browser.credits)),
|
||||
)
|
||||
|
||||
OBJECTS = {Thread: fill_thread,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue