rpa-suite 1.0.2__py3-none-any.whl → 1.0.3__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.
- rpa_suite/file/screen_shot.py +82 -0
- {rpa_suite-1.0.2.dist-info → rpa_suite-1.0.3.dist-info}/METADATA +6 -2
- {rpa_suite-1.0.2.dist-info → rpa_suite-1.0.3.dist-info}/RECORD +6 -5
- {rpa_suite-1.0.2.dist-info → rpa_suite-1.0.3.dist-info}/LICENSE +0 -0
- {rpa_suite-1.0.2.dist-info → rpa_suite-1.0.3.dist-info}/WHEEL +0 -0
- {rpa_suite-1.0.2.dist-info → rpa_suite-1.0.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
# /screen_shot.py
|
2
|
+
|
3
|
+
import os, time
|
4
|
+
from datetime import datetime
|
5
|
+
from rpa_suite import suite as rpa
|
6
|
+
|
7
|
+
|
8
|
+
try:
|
9
|
+
import pyautogui
|
10
|
+
import pyscreeze
|
11
|
+
|
12
|
+
except ImportError:
|
13
|
+
raise ImportError(" The ‘pyautogui’, ‘Pillow’, and ‘PyScreeze’ libraries are necessary to use this module. Please install them with ‘pip install pyautogui pillow pyscreeze’.")
|
14
|
+
|
15
|
+
|
16
|
+
def screen_shot(file_path: str, file_name: str = 'screenshot', save_with_date: bool = True, delay: int = 1) -> str | None:
|
17
|
+
|
18
|
+
"""
|
19
|
+
Function responsible for create a dir for screenshot, and file screenshot and save this in dir to create, if dir exists save it on original dir. By default uses date on file name. \n
|
20
|
+
|
21
|
+
Parameters:
|
22
|
+
----------
|
23
|
+
``file_path: str`` - should be a string, not have a default path.
|
24
|
+
``file_name: str`` - should be a string, by default name is `screenshot`.
|
25
|
+
``save_with_date: bool`` - should be a boolean, by default `True` save namefile with date `foo_dd_mm_yyyy-hh_mm_ss.png`.
|
26
|
+
``delay: int`` - should be a int, by default 1 (represents seconds).
|
27
|
+
|
28
|
+
Return:
|
29
|
+
----------
|
30
|
+
>>> type:str
|
31
|
+
* 'screenshot_path': str - represents the absulute path created for this file
|
32
|
+
|
33
|
+
Description: pt-br
|
34
|
+
----------
|
35
|
+
Função responsável por criar um diretório para captura de tela, e arquivo de captura de tela e salvar isso no diretório a ser criado, se o diretório existir, salve-o no diretório original. Por padrão, usa a data no nome do arquivo.
|
36
|
+
|
37
|
+
Parâmetros:
|
38
|
+
----------
|
39
|
+
``file_path: str`` - deve ser uma string, não tem um caminho padrão.
|
40
|
+
``file_name: str`` - deve ser uma string, por padrão o nome é `screenshot`.
|
41
|
+
``save_with_date: bool`` - deve ser um booleano, por padrão `True` salva o nome do arquivo com a data `foo_dd_mm_yyyy-hh_mm_ss.png`.
|
42
|
+
``delay: int`` - deve ser um int, por padrão 1 representado em segundo(s).
|
43
|
+
|
44
|
+
Retorno:
|
45
|
+
----------
|
46
|
+
>>> tipo: str
|
47
|
+
* 'screenshot_path': str - representa o caminho absoluto do arquivo criado
|
48
|
+
"""
|
49
|
+
|
50
|
+
# proccess
|
51
|
+
try:
|
52
|
+
|
53
|
+
time.sleep(delay)
|
54
|
+
if not os.path.exists(file_path):
|
55
|
+
|
56
|
+
# if dir not exists create it
|
57
|
+
try:
|
58
|
+
os.makedirs(file_path)
|
59
|
+
rpa.success_print(f"Diretório criado com sucesso em: '{file_path}'!")
|
60
|
+
|
61
|
+
except OSError as e:
|
62
|
+
rpa.error_print(f"Falha ao criar o diretório em: '{file_path}'! Error: {str(e)}")
|
63
|
+
|
64
|
+
|
65
|
+
if save_with_date: # use date on file name
|
66
|
+
image = pyautogui.screenshot()
|
67
|
+
path_file_screenshoted = fr'{file_path}/{file_name}_{datetime.today().strftime("%d_%m_%Y-%H_%M_%S")}.png'
|
68
|
+
|
69
|
+
image.save(path_file_screenshoted)
|
70
|
+
return os.path.abspath(path_file_screenshoted)
|
71
|
+
|
72
|
+
else: # not use date on file name
|
73
|
+
image = pyautogui.screenshot()
|
74
|
+
path_file_screenshoted = fr'{file_path}/{file_name}.png'
|
75
|
+
|
76
|
+
image.save(path_file_screenshoted)
|
77
|
+
return os.path.abspath(path_file_screenshoted)
|
78
|
+
|
79
|
+
except Exception as e:
|
80
|
+
|
81
|
+
rpa.error_print(f'Erro durante a função {screen_shot.__name__}! Error: {str(e)}')
|
82
|
+
return None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: rpa-suite
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.3
|
4
4
|
Summary: Conjunto de ferramentas essenciais para Automação RPA com Python, que facilitam o dia a dia de desenvolvimento.
|
5
5
|
Author: Camilo Costa de Carvalho
|
6
6
|
Author-email: camilo.carvalho@triasoftware.com.br
|
@@ -127,6 +127,9 @@ No setup do nosso projeto já estão inclusas as dependências, só será necess
|
|
127
127
|
- loguru
|
128
128
|
- email-validator
|
129
129
|
- colorlog
|
130
|
+
|
131
|
+
[!IMPORTANT]
|
132
|
+
No caso da função de screenshot é necessario ter as libs 'pyautogui' 'pillow' e 'pyscreeze' instalados, geralmente a instalação de pyautogui já instala as demais dependencias deste caso.
|
130
133
|
|
131
134
|
## Estrutura do módulo
|
132
135
|
O módulo principal do rpa-suite é dividido em categorias. Cada categoria contém módulos com funções destinadas a cada tipo de tarefa
|
@@ -141,6 +144,7 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
|
|
141
144
|
- **file**
|
142
145
|
- **counter** - Funções para contagem de arquivos
|
143
146
|
- **temp_dir** - Funções para diretórios temporários
|
147
|
+
-**screen_shot** - Função para criar diretório e arquivo de print com nome do diretório, arquivo e delay personalizáveis.
|
144
148
|
- **log**
|
145
149
|
- **logger_uru** - Instanciador de stream e handlefile que cria na pasta raiz do arquivo chamador pasta de log e seta o stream para as funções de log
|
146
150
|
- **functions_logger_uru** - Funções de log parecida com os prints personalizados, setadas e personalizadas para todos log levels usado pelo ´logger_uru´, já escreve no arquivo setado além de gerar o print no terminal
|
@@ -152,7 +156,7 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
|
|
152
156
|
- **string_validator** - Função que valida presença de letras, palavras, e texto em strings
|
153
157
|
|
154
158
|
## Release
|
155
|
-
Versão: **Beta 1.0.
|
159
|
+
Versão: **Beta 1.0.3**
|
156
160
|
|
157
161
|
Lançamento: *20/02/2024*
|
158
162
|
|
@@ -10,6 +10,7 @@ rpa_suite/email/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,1
|
|
10
10
|
rpa_suite/email/sender_smtp.py,sha256=e6DgITLLB1Acx1yQbHBargHT3UGxLDpTdHkQ0w8EgaM,7598
|
11
11
|
rpa_suite/file/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
|
12
12
|
rpa_suite/file/counter.py,sha256=vFaqENBC6HLv7dHmEmibsHhLVfumTM6Dh7p-u2g6s5Y,2483
|
13
|
+
rpa_suite/file/screen_shot.py,sha256=3SFKSS1Kb9UlKY3Lt6cE9Bym7i44iu7XeMqzZ2d4dhc,3282
|
13
14
|
rpa_suite/file/temp_dir.py,sha256=NnoLbpgCm9ZoC2D2mzywo756d8BBt_1fhQeNUUnxsPs,7134
|
14
15
|
rpa_suite/log/__create_log_dir.py,sha256=Lm3qbIhJ0z4zBkRIdR5AFw8voBRaAGuEwr8G-6cSPGg,3318
|
15
16
|
rpa_suite/log/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
|
@@ -26,8 +27,8 @@ rpa_suite/regex/list_from_text.py,sha256=HJaV_nhjCjn8UkJgEsnnKO2hYuE-zVDCAH9MD6X
|
|
26
27
|
rpa_suite/validate/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
|
27
28
|
rpa_suite/validate/mail_validator.py,sha256=dtFdthDd3gHyJ0uEUT9yPFFP1yyq4TXLxKLV1gqcNMo,2930
|
28
29
|
rpa_suite/validate/string_validator.py,sha256=8dGAHhvZu19yIVOoX-te1pVqVi7cwDrFJKf107cLgvA,5370
|
29
|
-
rpa_suite-1.0.
|
30
|
-
rpa_suite-1.0.
|
31
|
-
rpa_suite-1.0.
|
32
|
-
rpa_suite-1.0.
|
33
|
-
rpa_suite-1.0.
|
30
|
+
rpa_suite-1.0.3.dist-info/LICENSE,sha256=5D8PIbs31iGd9i1_MDNg4SzaQnp9sEIULALh2y3WyMI,1102
|
31
|
+
rpa_suite-1.0.3.dist-info/METADATA,sha256=CpzZ1QqgR998I_tGfzPZSGwMUjJkMK1GLNRG0cuRC7k,7729
|
32
|
+
rpa_suite-1.0.3.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
|
33
|
+
rpa_suite-1.0.3.dist-info/top_level.txt,sha256=HYkDtg-kJNAr3F2XAIPyJ-QBbNhk7q6jrqsFt10lz4Y,10
|
34
|
+
rpa_suite-1.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|