📱 HeyTelecom Python Library
"I just want my usage data" Edition 🚀
Quick Install | Getting Started | API Reference | Features | Contributing
Automate your Hey! Telecom account. Get usage, invoices, and more without lifting a finger.
⚠️ Unofficial library. Use against your own account only and respect Hey Telecom's terms of service. The portal sits behind Imperva/Incapsula; automated access may occasionally fail.
📦 Quick Install
Requires Python 3.9+.
pip install heytelecom
🏠 Home Assistant Integration
This whole project was basically an excuse to get my data into Home Assistant.
How it works now:
- The Library: Pure Python — no browser, no heavy dependencies. Just
requests+ OAuth2. - The Integration: A lightweight HA component that talks to the library and creates sensors.
🛠️ Getting Started
from heytelecom import HeyTelecomClient, APIError, AuthenticationError
with HeyTelecomClient(email="your@email.com", password="your_password") as client:
client.login()
account_data = client.get_account_data()
print(f"You have {len(account_data.products)} products.")
if account_data.latest_invoice:
print(f"Latest invoice: €{account_data.latest_invoice.amount_eur}")
Credentials can also be supplied via environment variables in example.py
(HEY_EMAIL / HEY_PASSWORD).
📖 API Reference
HeyTelecomClient(email=None, password=None)
| Method | Returns | Notes |
|---|---|---|
login() |
str (access token) |
Required before data calls unless you only construct the client after obtaining a token another way. |
get_account_data(use_cache=True) |
AccountData |
Products + latest invoice (fetched in parallel). |
get_products(use_cache=True) |
list[Product] |
Mobile usage fetched in parallel per line. |
get_latest_invoice(use_cache=True) |
Invoice | None |
None if the account has no invoices. |
get_invoices() |
list[Invoice] |
Full invoice list (not cached). |
get_benefits() |
raw JSON | Passthrough of the benefits endpoint. |
get_profile_products() |
raw JSON | Passthrough of profile products. |
invalidate_cache() |
None |
Drop TTL cache entries. |
clear_credentials() |
None |
Wipe email/password from memory. Auto re-login on token expiry will then fail until login() is called again. |
close() |
None |
Close the HTTP session (also via context manager). |
Models
AccountData:provider,products,latest_invoice—.to_dict()skipsNone/empty lists.Product:product_id,product_type(mobile/internet/ …),phone_number,easy_switch_number,tariff,contract,usage.UsageData:period,data(used/limitin GB),calls,sms_mms.Invoice:invoice_id,amount_eur,status,paid,date,due_date.Contract:price_per_month_eur.
Exceptions
| Exception | When |
|---|---|
HeyTelecomError |
Base class |
AuthenticationError |
Login failed, missing auth, 401/403, token expired without credentials |
APIError |
Network failure, non-2xx (with .status_code), non-JSON / Incapsula HTML, unexpected payload shape |
from heytelecom import HeyTelecomClient, APIError, AuthenticationError
try:
with HeyTelecomClient(email=..., password=...) as client:
client.login()
print(client.get_products())
except AuthenticationError as e:
print("Auth problem:", e)
except APIError as e:
print("API problem:", e, "status=", e.status_code)
Caching & tokens
- Product inventory and latest invoice are cached for 60 seconds (in-memory TTL).
- Access tokens expire after ~1 hour; the client renews ~5 minutes early using
expires_infrom the token response, via a full email/password re-login (the public web client does not expose a refresh-token grant). - After
clear_credentials(), expired tokens raiseAuthenticationErrorinstead of re-login.
🤖 How it Works
- The Setup: We use requests (plain HTTP) — no browser needed. Just OAuth2 with PKCE, exactly like the web app does.
- The Login: Authenticates via the same OIDC flow the browser uses — email/password → BFF auth endpoint → authorization code → access token.
- The Grab: Calls the same BFF JSON APIs the web app uses to get products, usage, and invoices.
- The Result: You get nice, clean Python objects to play with. No more parsing HTML yourself!
See the research folder for sanitized reverse-engineering notes.
✨ Features
- Auto Login: Handles the OAuth2/PKCE auth flow automatically.
- Token Refresh: Re-authenticates transparently when the access token expires (while credentials remain available).
- Product Info: Mobile, Internet, whatever you got.
- Usage Stats: Data (GB), Calls, SMS.
- Invoices: Latest + full list.
- Typed errors:
APIError/AuthenticationErrorwith optional HTTP status.
📖 The Story (or "Why?")
So, here's the tea. I wanted to integrate my mobile usage into my dashboard. I checked for an API. Crickets.
The official API is not public, but I reverse-engineered the web app's traffic using a HAR capture (see the research folder). The e-care portal uses standard OAuth2/PKCE + a set of BFF JSON endpoints, so I rebuilt the whole flow with plain HTTP requests — no browser required.
Now I can graph my data usage and feel guilty about it in real-time.
🤝 Contributing
Found a bug? Want to add a feature? PRs are welcome.
pip install -e ".[dev]"
ruff check src/ tests/
ruff format src/ tests/
pytest
See CHANGELOG.md for release notes.
Made with ❤️ and a lot of debugging.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file heytelecom-0.2.2.tar.gz.
File metadata
- Download URL: heytelecom-0.2.2.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ad1a09c9af50c309a77947ec71666ae2a42e788735b1722ef40f4cfc85bc5f7
|
|
| MD5 |
09c945a1850f2531d26f3510b07a9505
|
|
| BLAKE2b-256 |
662117c8d8de3cba5ac579701adf625c986949b62cbc23efafba7fa746025c37
|
Provenance
The following attestation bundles were made for heytelecom-0.2.2.tar.gz:
Publisher:
publish.yml on MauroDruwel/HeyTelecom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heytelecom-0.2.2.tar.gz -
Subject digest:
6ad1a09c9af50c309a77947ec71666ae2a42e788735b1722ef40f4cfc85bc5f7 - Sigstore transparency entry: 2301804248
- Sigstore integration time:
-
Permalink:
MauroDruwel/HeyTelecom@a6e59917f342cacc968ee0e3c340b14b81193bda -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/MauroDruwel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a6e59917f342cacc968ee0e3c340b14b81193bda -
Trigger Event:
push
-
Statement type:
File details
Details for the file heytelecom-0.2.2-py3-none-any.whl.
File metadata
- Download URL: heytelecom-0.2.2-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9468aa847515370fc86ec0a7fa92271633f2618601246465ca66e9e0a59f54a
|
|
| MD5 |
13c1f631748611f794eedd96c7be497a
|
|
| BLAKE2b-256 |
5efdd9481df16db0570b8c15e062062aa306d8bbcbcd94680a59754b2e482b61
|
Provenance
The following attestation bundles were made for heytelecom-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on MauroDruwel/HeyTelecom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heytelecom-0.2.2-py3-none-any.whl -
Subject digest:
a9468aa847515370fc86ec0a7fa92271633f2618601246465ca66e9e0a59f54a - Sigstore transparency entry: 2301804583
- Sigstore integration time:
-
Permalink:
MauroDruwel/HeyTelecom@a6e59917f342cacc968ee0e3c340b14b81193bda -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/MauroDruwel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a6e59917f342cacc968ee0e3c340b14b81193bda -
Trigger Event:
push
-
Statement type: