triangle-api 0.1.0__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- triangle_api-0.1.1/PKG-INFO +108 -0
- triangle_api-0.1.1/README.md +85 -0
- {triangle_api-0.1.0 → triangle_api-0.1.1}/setup.py +1 -1
- triangle_api-0.1.1/triangle_api/__init__.py +4 -0
- triangle_api-0.1.1/triangle_api.egg-info/PKG-INFO +108 -0
- triangle_api-0.1.0/PKG-INFO +0 -106
- triangle_api-0.1.0/README.md +0 -83
- triangle_api-0.1.0/triangle_api/__init__.py +0 -4
- triangle_api-0.1.0/triangle_api.egg-info/PKG-INFO +0 -106
- {triangle_api-0.1.0 → triangle_api-0.1.1}/setup.cfg +0 -0
- {triangle_api-0.1.0 → triangle_api-0.1.1}/triangle_api/client.py +0 -0
- {triangle_api-0.1.0 → triangle_api-0.1.1}/triangle_api/exceptions.py +0 -0
- {triangle_api-0.1.0 → triangle_api-0.1.1}/triangle_api.egg-info/SOURCES.txt +0 -0
- {triangle_api-0.1.0 → triangle_api-0.1.1}/triangle_api.egg-info/dependency_links.txt +0 -0
- {triangle_api-0.1.0 → triangle_api-0.1.1}/triangle_api.egg-info/requires.txt +0 -0
- {triangle_api-0.1.0 → triangle_api-0.1.1}/triangle_api.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: triangle-api
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Unofficial Python wrapper for Canadian Tire Triangle Mastercard API
|
|
5
|
+
Home-page: https://github.com/diogobas/triangle-api
|
|
6
|
+
Author: Diogo Bastos
|
|
7
|
+
Author-email: seu-email@exemplo.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: playwright>=1.40.0
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: home-page
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
Dynamic: requires-python
|
|
22
|
+
Dynamic: summary
|
|
23
|
+
|
|
24
|
+
# Triangle Mastercard API (Unofficial) 🇨🇦
|
|
25
|
+
|
|
26
|
+
[](https://www.python.org/downloads/)
|
|
27
|
+
[](https://opensource.org/licenses/MIT)
|
|
28
|
+
[](https://github.com/diogobas/triangle-api/graphs/commit-activity)
|
|
29
|
+
|
|
30
|
+
A Python wrapper for the private **Triangle Mastercard (Canadian Tire Financial Services)** API.
|
|
31
|
+
|
|
32
|
+
This project reverse engineers the official web portal to extract balance, limit, and transaction information, allowing you to integrate your financial data into your own apps, bots, or spreadsheets.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## ⚠️ Legal Notice (Disclaimer)
|
|
37
|
+
|
|
38
|
+
**This project is not affiliated with, maintained, authorized, endorsed, or sponsored by Canadian Tire Financial Services (CTFS) or any of its affiliates.**
|
|
39
|
+
|
|
40
|
+
This is independent software for educational and personal use. Using automation to access banking accounts may violate the institution's Terms of Service. Use responsibly and at your own risk.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## ✨ Features
|
|
45
|
+
|
|
46
|
+
- [x] **Automated Authentication**: Performs login with Playwright while handling bot protection.
|
|
47
|
+
- [x] **MFA Support**: Detects and prompts for SMS/Security code input in the terminal.
|
|
48
|
+
- [x] **Session Persistence**: Stores cookies locally to avoid frequent logins and reduce blocking risk.
|
|
49
|
+
- [x] **Account Summary**: Current balance, available credit, total limit, and due date.
|
|
50
|
+
- [ ] **Transaction History**: (In development)
|
|
51
|
+
- [ ] **Triangle Rewards**: Canadian Tire Money balance (In development)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 🚀 Installation
|
|
56
|
+
|
|
57
|
+
1. Clone the repository:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git clone https://github.com/diogobas/triangle-api.git
|
|
61
|
+
cd triangle-api
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
2. Install dependencies: `pip install -r requirements.txt`
|
|
65
|
+
|
|
66
|
+
3. Install the browser required by Playwright: `playwright install chromium`
|
|
67
|
+
|
|
68
|
+
## 💻 Usage Example
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from triangle_api.client import TriangleClient
|
|
72
|
+
import os
|
|
73
|
+
|
|
74
|
+
# Using environment variables is recommended for security
|
|
75
|
+
USER = "your_email@example.com"
|
|
76
|
+
PASSWORD = "your_secret_password"
|
|
77
|
+
|
|
78
|
+
# Instantiate the client
|
|
79
|
+
client = TriangleClient(username=USER, password=PASSWORD)
|
|
80
|
+
|
|
81
|
+
# Log in (opens browser on first run, uses cookies on next runs)
|
|
82
|
+
# headless=False lets you watch browser activity
|
|
83
|
+
data = client.login(headless=True)
|
|
84
|
+
|
|
85
|
+
print(f"Current Balance: $ {client.get_balance()}")
|
|
86
|
+
print(f"Available Credit: $ {data.get('availableCreditAmt')}")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 🔒 Security and Persistence
|
|
90
|
+
|
|
91
|
+
To avoid raising suspicion from multiple logins, this wrapper uses
|
|
92
|
+
Playwright's `storage_state` feature.
|
|
93
|
+
|
|
94
|
+
- After the first successful login, an `auth_state.json` file is created.
|
|
95
|
+
- On subsequent runs, the script tries to use these cookies to access the
|
|
96
|
+
Dashboard directly.
|
|
97
|
+
- Important: Never commit `auth_state.json` to GitHub (it should already be in
|
|
98
|
+
`.gitignore`).
|
|
99
|
+
|
|
100
|
+
## 🛠️ Development
|
|
101
|
+
|
|
102
|
+
If you want to contribute by mapping new endpoints (such as transactions or
|
|
103
|
+
offers), follow these steps:
|
|
104
|
+
|
|
105
|
+
1. Log in to the CTFS website with Inspect mode (F12) open.
|
|
106
|
+
2. Filter by XHR/Fetch calls.
|
|
107
|
+
3. Look for endpoints such as `retrieveTransactions` or `retrieveLoyalty`.
|
|
108
|
+
4. Map the response JSON in the `TriangleClient` class.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Triangle Mastercard API (Unofficial) 🇨🇦
|
|
2
|
+
|
|
3
|
+
[](https://www.python.org/downloads/)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://github.com/diogobas/triangle-api/graphs/commit-activity)
|
|
6
|
+
|
|
7
|
+
A Python wrapper for the private **Triangle Mastercard (Canadian Tire Financial Services)** API.
|
|
8
|
+
|
|
9
|
+
This project reverse engineers the official web portal to extract balance, limit, and transaction information, allowing you to integrate your financial data into your own apps, bots, or spreadsheets.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ⚠️ Legal Notice (Disclaimer)
|
|
14
|
+
|
|
15
|
+
**This project is not affiliated with, maintained, authorized, endorsed, or sponsored by Canadian Tire Financial Services (CTFS) or any of its affiliates.**
|
|
16
|
+
|
|
17
|
+
This is independent software for educational and personal use. Using automation to access banking accounts may violate the institution's Terms of Service. Use responsibly and at your own risk.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## ✨ Features
|
|
22
|
+
|
|
23
|
+
- [x] **Automated Authentication**: Performs login with Playwright while handling bot protection.
|
|
24
|
+
- [x] **MFA Support**: Detects and prompts for SMS/Security code input in the terminal.
|
|
25
|
+
- [x] **Session Persistence**: Stores cookies locally to avoid frequent logins and reduce blocking risk.
|
|
26
|
+
- [x] **Account Summary**: Current balance, available credit, total limit, and due date.
|
|
27
|
+
- [ ] **Transaction History**: (In development)
|
|
28
|
+
- [ ] **Triangle Rewards**: Canadian Tire Money balance (In development)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 🚀 Installation
|
|
33
|
+
|
|
34
|
+
1. Clone the repository:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/diogobas/triangle-api.git
|
|
38
|
+
cd triangle-api
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. Install dependencies: `pip install -r requirements.txt`
|
|
42
|
+
|
|
43
|
+
3. Install the browser required by Playwright: `playwright install chromium`
|
|
44
|
+
|
|
45
|
+
## 💻 Usage Example
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from triangle_api.client import TriangleClient
|
|
49
|
+
import os
|
|
50
|
+
|
|
51
|
+
# Using environment variables is recommended for security
|
|
52
|
+
USER = "your_email@example.com"
|
|
53
|
+
PASSWORD = "your_secret_password"
|
|
54
|
+
|
|
55
|
+
# Instantiate the client
|
|
56
|
+
client = TriangleClient(username=USER, password=PASSWORD)
|
|
57
|
+
|
|
58
|
+
# Log in (opens browser on first run, uses cookies on next runs)
|
|
59
|
+
# headless=False lets you watch browser activity
|
|
60
|
+
data = client.login(headless=True)
|
|
61
|
+
|
|
62
|
+
print(f"Current Balance: $ {client.get_balance()}")
|
|
63
|
+
print(f"Available Credit: $ {data.get('availableCreditAmt')}")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 🔒 Security and Persistence
|
|
67
|
+
|
|
68
|
+
To avoid raising suspicion from multiple logins, this wrapper uses
|
|
69
|
+
Playwright's `storage_state` feature.
|
|
70
|
+
|
|
71
|
+
- After the first successful login, an `auth_state.json` file is created.
|
|
72
|
+
- On subsequent runs, the script tries to use these cookies to access the
|
|
73
|
+
Dashboard directly.
|
|
74
|
+
- Important: Never commit `auth_state.json` to GitHub (it should already be in
|
|
75
|
+
`.gitignore`).
|
|
76
|
+
|
|
77
|
+
## 🛠️ Development
|
|
78
|
+
|
|
79
|
+
If you want to contribute by mapping new endpoints (such as transactions or
|
|
80
|
+
offers), follow these steps:
|
|
81
|
+
|
|
82
|
+
1. Log in to the CTFS website with Inspect mode (F12) open.
|
|
83
|
+
2. Filter by XHR/Fetch calls.
|
|
84
|
+
3. Look for endpoints such as `retrieveTransactions` or `retrieveLoyalty`.
|
|
85
|
+
4. Map the response JSON in the `TriangleClient` class.
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="triangle-api", # Nome que aparecerá no PyPI
|
|
8
|
-
version="0.1.
|
|
8
|
+
version="0.1.1",
|
|
9
9
|
author="Diogo Bastos",
|
|
10
10
|
author_email="seu-email@exemplo.com", # Opcional
|
|
11
11
|
description="Unofficial Python wrapper for Canadian Tire Triangle Mastercard API",
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: triangle-api
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Unofficial Python wrapper for Canadian Tire Triangle Mastercard API
|
|
5
|
+
Home-page: https://github.com/diogobas/triangle-api
|
|
6
|
+
Author: Diogo Bastos
|
|
7
|
+
Author-email: seu-email@exemplo.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: playwright>=1.40.0
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: home-page
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
Dynamic: requires-python
|
|
22
|
+
Dynamic: summary
|
|
23
|
+
|
|
24
|
+
# Triangle Mastercard API (Unofficial) 🇨🇦
|
|
25
|
+
|
|
26
|
+
[](https://www.python.org/downloads/)
|
|
27
|
+
[](https://opensource.org/licenses/MIT)
|
|
28
|
+
[](https://github.com/diogobas/triangle-api/graphs/commit-activity)
|
|
29
|
+
|
|
30
|
+
A Python wrapper for the private **Triangle Mastercard (Canadian Tire Financial Services)** API.
|
|
31
|
+
|
|
32
|
+
This project reverse engineers the official web portal to extract balance, limit, and transaction information, allowing you to integrate your financial data into your own apps, bots, or spreadsheets.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## ⚠️ Legal Notice (Disclaimer)
|
|
37
|
+
|
|
38
|
+
**This project is not affiliated with, maintained, authorized, endorsed, or sponsored by Canadian Tire Financial Services (CTFS) or any of its affiliates.**
|
|
39
|
+
|
|
40
|
+
This is independent software for educational and personal use. Using automation to access banking accounts may violate the institution's Terms of Service. Use responsibly and at your own risk.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## ✨ Features
|
|
45
|
+
|
|
46
|
+
- [x] **Automated Authentication**: Performs login with Playwright while handling bot protection.
|
|
47
|
+
- [x] **MFA Support**: Detects and prompts for SMS/Security code input in the terminal.
|
|
48
|
+
- [x] **Session Persistence**: Stores cookies locally to avoid frequent logins and reduce blocking risk.
|
|
49
|
+
- [x] **Account Summary**: Current balance, available credit, total limit, and due date.
|
|
50
|
+
- [ ] **Transaction History**: (In development)
|
|
51
|
+
- [ ] **Triangle Rewards**: Canadian Tire Money balance (In development)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 🚀 Installation
|
|
56
|
+
|
|
57
|
+
1. Clone the repository:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git clone https://github.com/diogobas/triangle-api.git
|
|
61
|
+
cd triangle-api
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
2. Install dependencies: `pip install -r requirements.txt`
|
|
65
|
+
|
|
66
|
+
3. Install the browser required by Playwright: `playwright install chromium`
|
|
67
|
+
|
|
68
|
+
## 💻 Usage Example
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from triangle_api.client import TriangleClient
|
|
72
|
+
import os
|
|
73
|
+
|
|
74
|
+
# Using environment variables is recommended for security
|
|
75
|
+
USER = "your_email@example.com"
|
|
76
|
+
PASSWORD = "your_secret_password"
|
|
77
|
+
|
|
78
|
+
# Instantiate the client
|
|
79
|
+
client = TriangleClient(username=USER, password=PASSWORD)
|
|
80
|
+
|
|
81
|
+
# Log in (opens browser on first run, uses cookies on next runs)
|
|
82
|
+
# headless=False lets you watch browser activity
|
|
83
|
+
data = client.login(headless=True)
|
|
84
|
+
|
|
85
|
+
print(f"Current Balance: $ {client.get_balance()}")
|
|
86
|
+
print(f"Available Credit: $ {data.get('availableCreditAmt')}")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 🔒 Security and Persistence
|
|
90
|
+
|
|
91
|
+
To avoid raising suspicion from multiple logins, this wrapper uses
|
|
92
|
+
Playwright's `storage_state` feature.
|
|
93
|
+
|
|
94
|
+
- After the first successful login, an `auth_state.json` file is created.
|
|
95
|
+
- On subsequent runs, the script tries to use these cookies to access the
|
|
96
|
+
Dashboard directly.
|
|
97
|
+
- Important: Never commit `auth_state.json` to GitHub (it should already be in
|
|
98
|
+
`.gitignore`).
|
|
99
|
+
|
|
100
|
+
## 🛠️ Development
|
|
101
|
+
|
|
102
|
+
If you want to contribute by mapping new endpoints (such as transactions or
|
|
103
|
+
offers), follow these steps:
|
|
104
|
+
|
|
105
|
+
1. Log in to the CTFS website with Inspect mode (F12) open.
|
|
106
|
+
2. Filter by XHR/Fetch calls.
|
|
107
|
+
3. Look for endpoints such as `retrieveTransactions` or `retrieveLoyalty`.
|
|
108
|
+
4. Map the response JSON in the `TriangleClient` class.
|
triangle_api-0.1.0/PKG-INFO
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: triangle-api
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Unofficial Python wrapper for Canadian Tire Triangle Mastercard API
|
|
5
|
-
Home-page: https://github.com/diogobas/triangle-api
|
|
6
|
-
Author: Diogo Bastos
|
|
7
|
-
Author-email: seu-email@exemplo.com
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.8
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: playwright>=1.40.0
|
|
14
|
-
Dynamic: author
|
|
15
|
-
Dynamic: author-email
|
|
16
|
-
Dynamic: classifier
|
|
17
|
-
Dynamic: description
|
|
18
|
-
Dynamic: description-content-type
|
|
19
|
-
Dynamic: home-page
|
|
20
|
-
Dynamic: requires-dist
|
|
21
|
-
Dynamic: requires-python
|
|
22
|
-
Dynamic: summary
|
|
23
|
-
|
|
24
|
-
# Triangle Mastercard API (Unofficial) 🇨🇦
|
|
25
|
-
|
|
26
|
-
[](https://www.python.org/downloads/)
|
|
27
|
-
[](https://opensource.org/licenses/MIT)
|
|
28
|
-
[](https://github.com/diogobas/triangle-api/graphs/commit-activity)
|
|
29
|
-
|
|
30
|
-
Um wrapper em Python para a API privada do **Triangle Mastercard (Canadian Tire Financial Services)**.
|
|
31
|
-
|
|
32
|
-
Este projeto realiza a engenharia reversa do portal web oficial para extrair informações de saldo, limites e transações, permitindo a integração dos seus dados financeiros em seus próprios aplicativos, bots ou planilhas.
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## ⚠️ Aviso Legal (Disclaimer)
|
|
37
|
-
|
|
38
|
-
**Este projeto não é afiliado, mantido, autorizado, endossado ou patrocinado pela Canadian Tire Financial Services (CTFS) ou qualquer uma de suas afiliadas.**
|
|
39
|
-
|
|
40
|
-
Este é um software independente para fins educacionais e de uso pessoal. O uso de automação para acessar contas bancárias pode violar os Termos de Serviço da instituição. Use com responsabilidade e por sua conta e risco.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## ✨ Funcionalidades
|
|
45
|
-
|
|
46
|
-
- [x] **Autenticação Automatizada**: Realiza o login via Playwright lidando com proteção de bots.
|
|
47
|
-
- [x] **Suporte a MFA**: Detecta e solicita o código de SMS/Segurança via terminal.
|
|
48
|
-
- [x] **Persistência de Sessão**: Salva cookies localmente para evitar logins constantes e reduzir o risco de bloqueio.
|
|
49
|
-
- [x] **Resumo da Conta**: Saldo atual, crédito disponível, limite total e data de vencimento.
|
|
50
|
-
- [ ] **Histórico de Transações**: (Em desenvolvimento)
|
|
51
|
-
- [ ] **Triangle Rewards**: Saldo de Canadian Tire Money (Em desenvolvimento)
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## 🚀 Instalação
|
|
56
|
-
|
|
57
|
-
1. Clone o repositório:
|
|
58
|
-
`git clone https://github.com/diogobas/triangle-api.git
|
|
59
|
-
cd triangle-api`
|
|
60
|
-
|
|
61
|
-
2. Instale as dependências: `pip install -r requirements.txt`
|
|
62
|
-
|
|
63
|
-
3. Instale o navegador necessário pelo Playwright: `playwright install chromium`
|
|
64
|
-
|
|
65
|
-
💻 Exemplo de Uso
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
from triangle_api.client
|
|
69
|
-
import TriangleClient
|
|
70
|
-
import os
|
|
71
|
-
|
|
72
|
-
# Recomenda-se usar variáveis de ambiente para segurança
|
|
73
|
-
USER = "seu_email@exemplo.com"
|
|
74
|
-
PASSWORD = "sua_senha_secreta"
|
|
75
|
-
|
|
76
|
-
# Instancia o cliente
|
|
77
|
-
client = TriangleClient(username=USER, password=PASSWORD)
|
|
78
|
-
|
|
79
|
-
# Realiza o login (abre o navegador na primeira vez, usa cookies nas próximas)
|
|
80
|
-
# headless=False permite ver o navegador operando
|
|
81
|
-
data = client.login(headless=True)
|
|
82
|
-
|
|
83
|
-
print(f"Saldo Atual: $ {client.get_balance()}")
|
|
84
|
-
print(f"Crédito Disponível: $ {data.get('availableCreditAmt')}")
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
🔒 Segurança e Persistência
|
|
88
|
-
|
|
89
|
-
Para evitar que o banco suspeite de múltiplos logins, este wrapper utiliza o
|
|
90
|
-
recurso storage_state do Playwright.
|
|
91
|
-
|
|
92
|
-
- Após o primeiro login bem-sucedido, um arquivo auth_state.json é criado.
|
|
93
|
-
- Nas próximas execuções, o script tentará usar esses cookies para acessar o
|
|
94
|
-
Dashboard diretamente.
|
|
95
|
-
- Atenção: Nunca envie o arquivo auth_state.json para o GitHub (ele já está no
|
|
96
|
-
.gitignore).
|
|
97
|
-
|
|
98
|
-
🛠️ Desenvolvimento
|
|
99
|
-
|
|
100
|
-
Se você quiser contribuir para o projeto mapeando novos endpoints (como
|
|
101
|
-
transações ou ofertas), siga estes passos:
|
|
102
|
-
|
|
103
|
-
1. Faça o login no site da CTFS com o modo Inspecionar (F12) aberto.
|
|
104
|
-
2. Filtre por chamadas XHR/Fetch.
|
|
105
|
-
3. Procure por endpoints como retrieveTransactions ou retrieveLoyalty.
|
|
106
|
-
4. Mapeie o JSON de resposta na classe TriangleClient.
|
triangle_api-0.1.0/README.md
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# Triangle Mastercard API (Unofficial) 🇨🇦
|
|
2
|
-
|
|
3
|
-
[](https://www.python.org/downloads/)
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://github.com/diogobas/triangle-api/graphs/commit-activity)
|
|
6
|
-
|
|
7
|
-
Um wrapper em Python para a API privada do **Triangle Mastercard (Canadian Tire Financial Services)**.
|
|
8
|
-
|
|
9
|
-
Este projeto realiza a engenharia reversa do portal web oficial para extrair informações de saldo, limites e transações, permitindo a integração dos seus dados financeiros em seus próprios aplicativos, bots ou planilhas.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## ⚠️ Aviso Legal (Disclaimer)
|
|
14
|
-
|
|
15
|
-
**Este projeto não é afiliado, mantido, autorizado, endossado ou patrocinado pela Canadian Tire Financial Services (CTFS) ou qualquer uma de suas afiliadas.**
|
|
16
|
-
|
|
17
|
-
Este é um software independente para fins educacionais e de uso pessoal. O uso de automação para acessar contas bancárias pode violar os Termos de Serviço da instituição. Use com responsabilidade e por sua conta e risco.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## ✨ Funcionalidades
|
|
22
|
-
|
|
23
|
-
- [x] **Autenticação Automatizada**: Realiza o login via Playwright lidando com proteção de bots.
|
|
24
|
-
- [x] **Suporte a MFA**: Detecta e solicita o código de SMS/Segurança via terminal.
|
|
25
|
-
- [x] **Persistência de Sessão**: Salva cookies localmente para evitar logins constantes e reduzir o risco de bloqueio.
|
|
26
|
-
- [x] **Resumo da Conta**: Saldo atual, crédito disponível, limite total e data de vencimento.
|
|
27
|
-
- [ ] **Histórico de Transações**: (Em desenvolvimento)
|
|
28
|
-
- [ ] **Triangle Rewards**: Saldo de Canadian Tire Money (Em desenvolvimento)
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## 🚀 Instalação
|
|
33
|
-
|
|
34
|
-
1. Clone o repositório:
|
|
35
|
-
`git clone https://github.com/diogobas/triangle-api.git
|
|
36
|
-
cd triangle-api`
|
|
37
|
-
|
|
38
|
-
2. Instale as dependências: `pip install -r requirements.txt`
|
|
39
|
-
|
|
40
|
-
3. Instale o navegador necessário pelo Playwright: `playwright install chromium`
|
|
41
|
-
|
|
42
|
-
💻 Exemplo de Uso
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
from triangle_api.client
|
|
46
|
-
import TriangleClient
|
|
47
|
-
import os
|
|
48
|
-
|
|
49
|
-
# Recomenda-se usar variáveis de ambiente para segurança
|
|
50
|
-
USER = "seu_email@exemplo.com"
|
|
51
|
-
PASSWORD = "sua_senha_secreta"
|
|
52
|
-
|
|
53
|
-
# Instancia o cliente
|
|
54
|
-
client = TriangleClient(username=USER, password=PASSWORD)
|
|
55
|
-
|
|
56
|
-
# Realiza o login (abre o navegador na primeira vez, usa cookies nas próximas)
|
|
57
|
-
# headless=False permite ver o navegador operando
|
|
58
|
-
data = client.login(headless=True)
|
|
59
|
-
|
|
60
|
-
print(f"Saldo Atual: $ {client.get_balance()}")
|
|
61
|
-
print(f"Crédito Disponível: $ {data.get('availableCreditAmt')}")
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
🔒 Segurança e Persistência
|
|
65
|
-
|
|
66
|
-
Para evitar que o banco suspeite de múltiplos logins, este wrapper utiliza o
|
|
67
|
-
recurso storage_state do Playwright.
|
|
68
|
-
|
|
69
|
-
- Após o primeiro login bem-sucedido, um arquivo auth_state.json é criado.
|
|
70
|
-
- Nas próximas execuções, o script tentará usar esses cookies para acessar o
|
|
71
|
-
Dashboard diretamente.
|
|
72
|
-
- Atenção: Nunca envie o arquivo auth_state.json para o GitHub (ele já está no
|
|
73
|
-
.gitignore).
|
|
74
|
-
|
|
75
|
-
🛠️ Desenvolvimento
|
|
76
|
-
|
|
77
|
-
Se você quiser contribuir para o projeto mapeando novos endpoints (como
|
|
78
|
-
transações ou ofertas), siga estes passos:
|
|
79
|
-
|
|
80
|
-
1. Faça o login no site da CTFS com o modo Inspecionar (F12) aberto.
|
|
81
|
-
2. Filtre por chamadas XHR/Fetch.
|
|
82
|
-
3. Procure por endpoints como retrieveTransactions ou retrieveLoyalty.
|
|
83
|
-
4. Mapeie o JSON de resposta na classe TriangleClient.
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: triangle-api
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Unofficial Python wrapper for Canadian Tire Triangle Mastercard API
|
|
5
|
-
Home-page: https://github.com/diogobas/triangle-api
|
|
6
|
-
Author: Diogo Bastos
|
|
7
|
-
Author-email: seu-email@exemplo.com
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.8
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: playwright>=1.40.0
|
|
14
|
-
Dynamic: author
|
|
15
|
-
Dynamic: author-email
|
|
16
|
-
Dynamic: classifier
|
|
17
|
-
Dynamic: description
|
|
18
|
-
Dynamic: description-content-type
|
|
19
|
-
Dynamic: home-page
|
|
20
|
-
Dynamic: requires-dist
|
|
21
|
-
Dynamic: requires-python
|
|
22
|
-
Dynamic: summary
|
|
23
|
-
|
|
24
|
-
# Triangle Mastercard API (Unofficial) 🇨🇦
|
|
25
|
-
|
|
26
|
-
[](https://www.python.org/downloads/)
|
|
27
|
-
[](https://opensource.org/licenses/MIT)
|
|
28
|
-
[](https://github.com/diogobas/triangle-api/graphs/commit-activity)
|
|
29
|
-
|
|
30
|
-
Um wrapper em Python para a API privada do **Triangle Mastercard (Canadian Tire Financial Services)**.
|
|
31
|
-
|
|
32
|
-
Este projeto realiza a engenharia reversa do portal web oficial para extrair informações de saldo, limites e transações, permitindo a integração dos seus dados financeiros em seus próprios aplicativos, bots ou planilhas.
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## ⚠️ Aviso Legal (Disclaimer)
|
|
37
|
-
|
|
38
|
-
**Este projeto não é afiliado, mantido, autorizado, endossado ou patrocinado pela Canadian Tire Financial Services (CTFS) ou qualquer uma de suas afiliadas.**
|
|
39
|
-
|
|
40
|
-
Este é um software independente para fins educacionais e de uso pessoal. O uso de automação para acessar contas bancárias pode violar os Termos de Serviço da instituição. Use com responsabilidade e por sua conta e risco.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## ✨ Funcionalidades
|
|
45
|
-
|
|
46
|
-
- [x] **Autenticação Automatizada**: Realiza o login via Playwright lidando com proteção de bots.
|
|
47
|
-
- [x] **Suporte a MFA**: Detecta e solicita o código de SMS/Segurança via terminal.
|
|
48
|
-
- [x] **Persistência de Sessão**: Salva cookies localmente para evitar logins constantes e reduzir o risco de bloqueio.
|
|
49
|
-
- [x] **Resumo da Conta**: Saldo atual, crédito disponível, limite total e data de vencimento.
|
|
50
|
-
- [ ] **Histórico de Transações**: (Em desenvolvimento)
|
|
51
|
-
- [ ] **Triangle Rewards**: Saldo de Canadian Tire Money (Em desenvolvimento)
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## 🚀 Instalação
|
|
56
|
-
|
|
57
|
-
1. Clone o repositório:
|
|
58
|
-
`git clone https://github.com/diogobas/triangle-api.git
|
|
59
|
-
cd triangle-api`
|
|
60
|
-
|
|
61
|
-
2. Instale as dependências: `pip install -r requirements.txt`
|
|
62
|
-
|
|
63
|
-
3. Instale o navegador necessário pelo Playwright: `playwright install chromium`
|
|
64
|
-
|
|
65
|
-
💻 Exemplo de Uso
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
from triangle_api.client
|
|
69
|
-
import TriangleClient
|
|
70
|
-
import os
|
|
71
|
-
|
|
72
|
-
# Recomenda-se usar variáveis de ambiente para segurança
|
|
73
|
-
USER = "seu_email@exemplo.com"
|
|
74
|
-
PASSWORD = "sua_senha_secreta"
|
|
75
|
-
|
|
76
|
-
# Instancia o cliente
|
|
77
|
-
client = TriangleClient(username=USER, password=PASSWORD)
|
|
78
|
-
|
|
79
|
-
# Realiza o login (abre o navegador na primeira vez, usa cookies nas próximas)
|
|
80
|
-
# headless=False permite ver o navegador operando
|
|
81
|
-
data = client.login(headless=True)
|
|
82
|
-
|
|
83
|
-
print(f"Saldo Atual: $ {client.get_balance()}")
|
|
84
|
-
print(f"Crédito Disponível: $ {data.get('availableCreditAmt')}")
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
🔒 Segurança e Persistência
|
|
88
|
-
|
|
89
|
-
Para evitar que o banco suspeite de múltiplos logins, este wrapper utiliza o
|
|
90
|
-
recurso storage_state do Playwright.
|
|
91
|
-
|
|
92
|
-
- Após o primeiro login bem-sucedido, um arquivo auth_state.json é criado.
|
|
93
|
-
- Nas próximas execuções, o script tentará usar esses cookies para acessar o
|
|
94
|
-
Dashboard diretamente.
|
|
95
|
-
- Atenção: Nunca envie o arquivo auth_state.json para o GitHub (ele já está no
|
|
96
|
-
.gitignore).
|
|
97
|
-
|
|
98
|
-
🛠️ Desenvolvimento
|
|
99
|
-
|
|
100
|
-
Se você quiser contribuir para o projeto mapeando novos endpoints (como
|
|
101
|
-
transações ou ofertas), siga estes passos:
|
|
102
|
-
|
|
103
|
-
1. Faça o login no site da CTFS com o modo Inspecionar (F12) aberto.
|
|
104
|
-
2. Filtre por chamadas XHR/Fetch.
|
|
105
|
-
3. Procure por endpoints como retrieveTransactions ou retrieveLoyalty.
|
|
106
|
-
4. Mapeie o JSON de resposta na classe TriangleClient.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|