https://github.com/skhg/pytescomobileirl
📱Unofficial Python API for accessing your Tesco Mobile Ireland account balance & usage stats
https://github.com/skhg/pytescomobileirl
ireland python-api tesco-mobile-ireland
Last synced: 3 days ago
JSON representation
📱Unofficial Python API for accessing your Tesco Mobile Ireland account balance & usage stats
- Host: GitHub
- URL: https://github.com/skhg/pytescomobileirl
- Owner: skhg
- License: mit
- Created: 2017-09-20T17:08:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-12-24T16:54:07.000Z (about 5 years ago)
- Last Synced: 2025-09-25T00:58:13.757Z (4 months ago)
- Topics: ireland, python-api, tesco-mobile-ireland
- Language: Python
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pytescomobileirl
[](https://pypi.python.org/pypi/pytescomobileirl/) [](https://codecov.io/gh/skhg/pytescomobileirl) 
A Python API for accessing your [Tesco Mobile Ireland](http://www.tescomobile.ie) 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](https://github.com/skhg/BitBar-Plugins/tree/master/TescoMobileIrl)
## Installation
`pip install pytescomobileirl`
## Usage
It's very easy to use. Try the following to get your balance data:
```python
from pytescomobileirl import *
from pprint import pprint
session = pytescomobileirl.TescoSession()
session.login("","")
balances = session.get_balances()
my_credit = balances.credit_remaining
my_data = balances.remaining_total("data")
print(my_credit)
print(my_data.summary())
pprint(vars(my_data))
```
returns:
```python
14.28
939 MB
{'balance_expires': datetime.datetime(2017, 10, 15, 0, 0),
'balance_type': u'data',
'is_active': True,
'remaining_qty': 939.181640625,
'serviceCode': u'AB3',
'unit': 'MByte'}
```
Or to get your usage history enter:
```python
usage = session.get_usage()
pprint(vars(usage.records[0]))
```
returns:
```python
{'called_number': u'tescomobile.liffeytelecom.com',
'charge': u'0.0',
'country_code': None,
'event_date': datetime.datetime(2017, 9, 23, 13, 33),
'roaming': False,
'service_code': u'GPBAS',
'service_name': u'GPRS Basic Service',
'unit': u'Bytes',
'use_type': u'DATA',
'volume': 119896.0}
```
## Tests
`python ./tests/tests.py`
## Contributing
Fork this repo, make some changes and create a new pull request!