cybertron-spark 0.1.1__tar.gz → 0.1.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cybertron-spark
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Automação do Zendesk com Selenium, Zenpy e integração Cybertron
5
5
  Author: Gustavo Sartorio
6
6
  Author-email: strov3rl@gmail.com
@@ -1,11 +1,9 @@
1
1
  import sys
2
2
  import os
3
- import json
4
3
  import requests
5
4
  import traceback
6
5
  import urllib3
7
6
  from dotenv import load_dotenv
8
- from datetime import datetime
9
7
 
10
8
  # Desabilita avisos de certificados inseguros (opcional, conforme seu código original)
11
9
  urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
@@ -107,7 +105,6 @@ class Heartbeat():
107
105
 
108
106
  payload = {
109
107
  'bot_id': self.bot_id,
110
- 'created_at': datetime.now().isoformat(),
111
108
  'ticket_id': ticket_id,
112
109
  'pedido': pedido,
113
110
  'protocolo': protocolo,
@@ -122,7 +119,6 @@ class Heartbeat():
122
119
  payload = {
123
120
  'bot_id': self.bot_id,
124
121
  'quantidade': quantidade,
125
- 'created_at': datetime.now().isoformat(),
126
122
  }
127
123
 
128
124
  self._post(endpoint, payload)
@@ -135,7 +131,6 @@ class Heartbeat():
135
131
  'cpu': cpu,
136
132
  'memory': memory,
137
133
  'disk': disk,
138
- 'updated_at': datetime.now().isoformat(),
139
134
  }
140
135
 
141
136
  self._put(endpoint, payload)
@@ -145,7 +140,6 @@ class Heartbeat():
145
140
 
146
141
  payload = {
147
142
  'bot_id': self.bot_id,
148
- 'updated_at': datetime.now().isoformat(),
149
143
  'current_status': status
150
144
  }
151
145
 
@@ -164,7 +158,6 @@ class Heartbeat():
164
158
  payload = {
165
159
  'codigo_erro': tipo_erro,
166
160
  'descricao': mensagem,
167
- 'data_log': datetime.now().isoformat(),
168
161
  'bot_id': self.bot_id,
169
162
  'resolvido': False,
170
163
  'tipo_alerta': tipo_alerta,
@@ -180,7 +173,6 @@ class Heartbeat():
180
173
 
181
174
  payload = {
182
175
  'bot_realizado': True,
183
- 'data_liberacao': datetime.now().isoformat()
184
176
  }
185
177
 
186
178
  self._patch(endpoint, payload)
@@ -1,3 +1,5 @@
1
+ import os
2
+ from dotenv import load_dotenv
1
3
  from time import sleep
2
4
  from selenium import webdriver
3
5
  from selenium.webdriver.chrome.options import Options as ChromeOptions
@@ -11,18 +13,20 @@ from selenium.webdriver.common.action_chains import ActionChains
11
13
  from selenium.webdriver.common.keys import Keys
12
14
  from selenium.common.exceptions import WebDriverException, NoSuchElementException, StaleElementReferenceException, TimeoutException
13
15
 
16
+ load_dotenv()
17
+
14
18
  # Constante global do módulo
15
19
  TIMEOUT = 300
16
20
 
17
21
  class Driver_Selenium():
18
22
  """Destinada a criação e gerenciamento de drivers do selenium."""
19
23
 
20
- def __init__(self, ipselenoid, browser='chrome', local=False, timeout='5m', headless=True, options=None):
24
+ def __init__(self, ipselenoid=None, browser='chrome', local=False, timeout='5m', headless=True, options=None):
21
25
  self.browser = browser
22
26
  self.local = local
23
27
  self.timeout = timeout
24
28
  self.headless = headless
25
- self.ipselenoid = ipselenoid
29
+ self.ipselenoid = ipselenoid or os.getenv('IPSELENOID')
26
30
  self.options = options
27
31
 
28
32
  def criar_driver(self):
@@ -1,21 +1,31 @@
1
1
  import requests
2
2
  import traceback
3
+ import os
4
+ from dotenv import load_dotenv
3
5
  from zenpy import Zenpy
4
6
  from zenpy.lib.api_objects import CustomField, Ticket, Comment, User
5
7
  from zenpy.lib.exception import APIException
6
8
  from typing import Optional, Dict, Any, Iterable, List
7
9
 
10
+ load_dotenv()
11
+
8
12
  # Reutilizando a sessão global se necessário
9
13
  session = requests.Session()
10
14
  session.verify = True
11
15
 
12
16
  class Zendesk_Zenpy:
13
17
  """Destinada a facilitar as automações via zenpy na zendesk."""
14
- def __init__(self, zlogin, zpass, instancia):
15
- self.zlogin = zlogin
16
- self.zpass = zpass
18
+ def __init__(self, instancia, zlogin=None, zpass=None):
17
19
  self.instancia = instancia
18
20
  self.zenpy_client = None
21
+ if self.instancia == 'atendimentomagazineluiza':
22
+ self.zlogin = zlogin or os.getenv('ZENPY_EMAIL')
23
+ self.zpass = zpass or os.getenv('ZENPY_TOKEN')
24
+
25
+ elif self.instancia == 'epocacosmeticos':
26
+ self.zlogin = zlogin or os.getenv('ZENPY_EMAIL_EPOCA')
27
+ self.zpass = zpass or os.getenv('ZENPY_TOKEN_EPOCA')
28
+
19
29
  self.auth_zenpy()
20
30
 
21
31
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cybertron-spark
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Automação do Zendesk com Selenium, Zenpy e integração Cybertron
5
5
  Author: Gustavo Sartorio
6
6
  Author-email: strov3rl@gmail.com
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as arq:
5
5
 
6
6
  setup(
7
7
  name='cybertron-spark',
8
- version='0.1.1',
8
+ version='0.1.3',
9
9
  license='MIT',
10
10
  author='Gustavo Sartorio',
11
11
  author_email='strov3rl@gmail.com',
File without changes