notify-utils 0.0.1__py3-none-any.whl
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.
- notify_utils/__init__.py +90 -0
- notify_utils/discount.py +335 -0
- notify_utils/models.py +532 -0
- notify_utils/notifiers/__init__.py +13 -0
- notify_utils/notifiers/discord_notifier.py +127 -0
- notify_utils/notifiers/formatters.py +108 -0
- notify_utils/parser.py +109 -0
- notify_utils/statistics.py +362 -0
- notify_utils/validators.py +98 -0
- notify_utils-0.0.1.dist-info/METADATA +133 -0
- notify_utils-0.0.1.dist-info/RECORD +14 -0
- notify_utils-0.0.1.dist-info/WHEEL +5 -0
- notify_utils-0.0.1.dist-info/licenses/LICENSE +21 -0
- notify_utils-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: notify-utils
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Biblioteca Python para parsing de preços de scraping, cálculo de descontos e análise estatística de histórico de preços.
|
|
5
|
+
Author-email: Naruto Uzumaki <naruto_uzumaki@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/jefersonAlbara/notify-utils
|
|
8
|
+
Project-URL: Repository, https://github.com/jefersonAlbara/notify-utils
|
|
9
|
+
Project-URL: Issues, https://github.com/jefersonAlbara/notify-utils/issues
|
|
10
|
+
Keywords: price-tracking,discount-calculator,web-scraping,e-commerce,price-history,discount-analysis,promotion-detection,statistics
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: discord-webhook>=1.4.1
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# notify-utils
|
|
25
|
+
|
|
26
|
+
Biblioteca Python para parsing de preços de scraping, cálculo de descontos e análise estatística de histórico de preços.
|
|
27
|
+
|
|
28
|
+
## Funcionalidades
|
|
29
|
+
|
|
30
|
+
- **Parser de Preços**: Normaliza strings de preços de diferentes formatos (BR, US)
|
|
31
|
+
- **Cálculo de Descontos**: Detecta descontos reais vs anunciados usando histórico
|
|
32
|
+
- **Análise Estatística**: Média, mediana, tendências e volatilidade de preços
|
|
33
|
+
- **Validação de Preços**: Sistema inteligente para validar preços antes de adicionar ao histórico
|
|
34
|
+
- **Notificações Discord**: Envio de alertas de preço via webhook (opcional)
|
|
35
|
+
|
|
36
|
+
## Instalação
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install notify-utils
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Uso Básico
|
|
43
|
+
|
|
44
|
+
### Parsing de Preços
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from notify_utils import parse_price
|
|
48
|
+
|
|
49
|
+
preco = parse_price("R$ 1.299,90") # → 1299.90
|
|
50
|
+
preco = parse_price("$1,299.90") # → 1299.90
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Cálculo de Desconto com Histórico
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from notify_utils import Price, get_discount_info
|
|
57
|
+
from datetime import datetime, timedelta
|
|
58
|
+
|
|
59
|
+
# Histórico de preços
|
|
60
|
+
precos = [
|
|
61
|
+
Price(value=1299.90, date=datetime.now() - timedelta(days=60)),
|
|
62
|
+
Price(value=1199.90, date=datetime.now() - timedelta(days=30)),
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
# Calcular desconto real baseado no histórico
|
|
66
|
+
info = get_discount_info(
|
|
67
|
+
current_price=899.90,
|
|
68
|
+
price_history=precos,
|
|
69
|
+
period_days=30
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
print(f"Desconto real: {info.discount_percentage:.2f}%")
|
|
73
|
+
print(f"É desconto real? {info.is_real_discount}")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Análise de Tendência
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from notify_utils import calculate_price_trend
|
|
80
|
+
|
|
81
|
+
trend = calculate_price_trend(precos, days=30)
|
|
82
|
+
|
|
83
|
+
print(f"Direção: {trend.direction}") # 'increasing', 'decreasing', 'stable'
|
|
84
|
+
print(f"Mudança: {trend.change_percentage:.2f}%")
|
|
85
|
+
print(f"Confiança: {trend.confidence}")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Validação de Preços
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from notify_utils import PriceHistory, Price, PriceAdditionStrategy
|
|
92
|
+
|
|
93
|
+
history = PriceHistory(product_id="PROD123", prices=precos)
|
|
94
|
+
|
|
95
|
+
# Validar antes de adicionar
|
|
96
|
+
novo_preco = Price(value=899.90, date=datetime.now())
|
|
97
|
+
result = history.add_price(
|
|
98
|
+
novo_preco,
|
|
99
|
+
strategy=PriceAdditionStrategy.SMART
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
if result.action.value == "added":
|
|
103
|
+
print(f"Preço adicionado: R$ {result.affected_price.value:.2f}")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Notificações Discord
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from notify_utils import Product, DiscordEmbedBuilder
|
|
110
|
+
|
|
111
|
+
produto = Product(
|
|
112
|
+
product_id="PROD123",
|
|
113
|
+
name="Notebook Gamer",
|
|
114
|
+
url="https://loja.com/produto"
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
builder = DiscordEmbedBuilder()
|
|
118
|
+
embed = builder.build_embed(produto, info, precos)
|
|
119
|
+
# Enviar via webhook Discord
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Documentação Completa
|
|
123
|
+
|
|
124
|
+
Para mais detalhes, consulte o arquivo [CLAUDE.md](CLAUDE.md) na raiz do projeto.
|
|
125
|
+
|
|
126
|
+
## Requisitos
|
|
127
|
+
|
|
128
|
+
- Python >= 3.12
|
|
129
|
+
- discord-webhook >= 1.4.1 (opcional, apenas para notificações)
|
|
130
|
+
|
|
131
|
+
## Licença
|
|
132
|
+
|
|
133
|
+
MIT
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
notify_utils/__init__.py,sha256=ebhDsS5auEWFGobvgDkUIQa3lTBT1Ykz6wUvEz1NF14,2034
|
|
2
|
+
notify_utils/discount.py,sha256=tIjifk7OkQEcLCXaHeY7QIAQyy1f_6FF4srusHyfTHw,12975
|
|
3
|
+
notify_utils/models.py,sha256=jRNZjVyXorMzA5sZUfU3M4IICzZhuOlmCOB793skuLo,19361
|
|
4
|
+
notify_utils/parser.py,sha256=IgEnClPQAOiAftkIVgQelIlSwDQvIFGIROWhOTiICbI,3191
|
|
5
|
+
notify_utils/statistics.py,sha256=-ggrNiF3LnC-SN6tgXrsijk9k2V8h1vP8GoXp-v5yZU,10390
|
|
6
|
+
notify_utils/validators.py,sha256=oa9fgTWVb1iKJmMgUpFGy8lMmMeggd9BvEkmeN5jOVc,2383
|
|
7
|
+
notify_utils/notifiers/__init__.py,sha256=sWDgtEYr7fSzWt7JcXnGnWW5GCFsvr9OfIJ_87IYOOQ,290
|
|
8
|
+
notify_utils/notifiers/discord_notifier.py,sha256=05w7e4IrxMlB-HnqsLSrLn9La-yHqeG72jpTGWTo8Jc,3640
|
|
9
|
+
notify_utils/notifiers/formatters.py,sha256=OH81_ibaUW5F9QezWxlZyUblYkO0SYAtuttFZPFNhdo,2928
|
|
10
|
+
notify_utils-0.0.1.dist-info/licenses/LICENSE,sha256=EAGnUR97L4E41x_9rLn8R8tVXrJrWFRt4gbaWNpKg54,1071
|
|
11
|
+
notify_utils-0.0.1.dist-info/METADATA,sha256=pm80DurbFJkj4ylu6sCMlLnIN_rtcnmutGPwCQvBjug,3986
|
|
12
|
+
notify_utils-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
notify_utils-0.0.1.dist-info/top_level.txt,sha256=FAuoT6qfsWZmQUxWC3kbB-5yLQONkFW-HWdfAwVXGGY,13
|
|
14
|
+
notify_utils-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Naruto Uzumaki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
notify_utils
|