-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
38 lines (32 loc) · 847 Bytes
/
Copy pathconfig.py
File metadata and controls
38 lines (32 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from ast import arg
import sys
args = sys.argv
concorrencia_default = 10
tempo_default = 3
requisicao = {
'metodo': 'GET',
'url': 'http://localhost:8080/api/v1/cep/86010580/',
'dados': '{}',
'headers': {
'content-type': 'application/json'
}
}
def gerar_config():
concorrencia = concorrencia_default
tempo = tempo_default
if len(args) == 3 and isNumeric(args[1]) and isNumeric(args[2]):
concorrencia = int(args[1])
tempo = int(args[2])
else:
print('Os parâmetros informados não estão no formato numérico válido, serão utilizados os valores default.')
return {
'concorrencia': concorrencia,
'tempo': tempo,
'requisicao': requisicao
}
def isNumeric(value):
try:
int(value)
return True
except:
return False