コード例 #1
0
class LifecellApiTest(unittest.TestCase):

  def setUp(self):
    self.s = LifecellSession('380931234567', '123456')
    self.api = LifecellApi(self.s)
    self.req = {
      'accessKeyCode': self.s.settings['access_key_code'],
      'msisdn': self.s.num,
      'superPassword': self.s.pwd
      }

  def testApiWrongRequest(self):
    try:
      self.api.wrongApi()
    except LifecellApiWrongMethodError as e:
      pass
    except e:
      self.fail('Unexpected exception throw:', e)
    else:
      self.fail('LifecellApiWrongMethodError not throw')

  def testApiErrorRequest(self):
    try:
      self.api.getToken()
    except LifecellApiError as e:
      pass
    except e:
      self.fail('Unexpected exception throw:', e)
    else:
      self.fail('LifecellApiError not throw')
コード例 #2
0
ファイル: main.py プロジェクト: sash13/pylifecellapi
def main():
  import logging.config
  logging.config.fileConfig('logging.conf')
  logger = logging.getLogger('main')
  s = LifecellSession(msisdn, pwd)
  ansv = s.signIn()
  api = LifecellApi(s)
  logger.debug(ansv)

  ansv = api.getBalances()

  print(json.dumps(ansv, indent=4))
コード例 #3
0
 def setUp(self):
   self.s = LifecellSession('380931234567', '123456')
   self.api = LifecellApi(self.s)
   self.req = {
     'accessKeyCode': self.s.settings['access_key_code'],
     'msisdn': self.s.num,
     'superPassword': self.s.pwd
     }