项目作者: skhg

项目描述 :
📱Unofficial Python API for accessing your Tesco Mobile Ireland account balance & usage stats
高级语言: Python
项目地址: git://github.com/skhg/pytescomobileirl.git
创建时间: 2017-09-20T17:08:17Z
项目社区:https://github.com/skhg/pytescomobileirl

开源协议:MIT License

下载


pytescomobileirl

PyPI Codecov PyPI - Downloads

A Python API for accessing your Tesco Mobile Ireland account balance & usage stats. This is an unoffical API and the author/contributors are in no way connected to Tesco or Tesco Mobile. The API provides methods to:

  • Get your current balances (€ credit and voice/text/data packages)
  • Get your usage records as far back as is available.

For an example of this in use, see my Tesco Mobile BitBar plugin

Installation

pip install pytescomobileirl

Usage

It’s very easy to use. Try the following to get your balance data:

  1. from pytescomobileirl import *
  2. from pprint import pprint
  3. session = pytescomobileirl.TescoSession()
  4. session.login("<PhoneNumber>","<Password>")
  5. balances = session.get_balances()
  6. my_credit = balances.credit_remaining
  7. my_data = balances.remaining_total("data")
  8. print(my_credit)
  9. print(my_data.summary())
  10. pprint(vars(my_data))

returns:

  1. 14.28
  2. 939 MB
  3. {'balance_expires': datetime.datetime(2017, 10, 15, 0, 0),
  4. 'balance_type': u'data',
  5. 'is_active': True,
  6. 'remaining_qty': 939.181640625,
  7. 'serviceCode': u'AB3',
  8. 'unit': 'MByte'}

Or to get your usage history enter:

  1. usage = session.get_usage()
  2. pprint(vars(usage.records[0]))

returns:

  1. {'called_number': u'tescomobile.liffeytelecom.com',
  2. 'charge': u'0.0',
  3. 'country_code': None,
  4. 'event_date': datetime.datetime(2017, 9, 23, 13, 33),
  5. 'roaming': False,
  6. 'service_code': u'GPBAS',
  7. 'service_name': u'GPRS Basic Service',
  8. 'unit': u'Bytes',
  9. 'use_type': u'DATA',
  10. 'volume': 119896.0}

Tests

python ./tests/tests.py

Contributing

Fork this repo, make some changes and create a new pull request!