cybertron-spark 0.1.0__tar.gz → 0.1.2__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.0
3
+ Version: 0.1.2
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,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.0
3
+ Version: 0.1.2
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,10 +1,10 @@
1
1
  LICENCE
2
2
  README.md
3
3
  setup.py
4
- cybertron-spark/__init__.py
5
- cybertron-spark/heartbeat.py
6
- cybertron-spark/selenium.py
7
- cybertron-spark/zenpy.py
4
+ cybertron_spark/__init__.py
5
+ cybertron_spark/heartbeat.py
6
+ cybertron_spark/selenium.py
7
+ cybertron_spark/zenpy.py
8
8
  cybertron_spark.egg-info/PKG-INFO
9
9
  cybertron_spark.egg-info/SOURCES.txt
10
10
  cybertron_spark.egg-info/dependency_links.txt
@@ -0,0 +1 @@
1
+ cybertron_spark
@@ -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.0',
8
+ version='0.1.2',
9
9
  license='MIT',
10
10
  author='Gustavo Sartorio',
11
11
  author_email='strov3rl@gmail.com',
@@ -1 +0,0 @@
1
- cybertron-spark
File without changes