-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathteste_request.py
More file actions
70 lines (60 loc) · 1.43 KB
/
Copy pathteste_request.py
File metadata and controls
70 lines (60 loc) · 1.43 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import json
import requests
url = "http://127.0.0.1:5001/invocations"
# payload = {
# "dataframe_split": {
# "columns": [
# "idade",
# "renda_mensal",
# "tempo_emprego_anos",
# "score_interno",
# "valor_solicitado",
# "num_parcelas",
# "tipo_renda",
# "possui_restricao",
# ],
# "data": [
# [34, 4200.0, 5.0, 620, 12000.0, 24, "CLT", "nao"],
# ],
# },
# "params": {
# "threshold": 0.5,
# },
# }
# response = requests.post(
# url,
# headers={"Content-Type": "application/json"},
# data=json.dumps(payload),
# timeout=30,
# )
# print("Status code:", response.status_code)
# print(response.json())
##########################################
payload_invalido = {
"dataframe_split": {
"columns": [
"idade",
"renda_mensal",
"tempo_emprego_anos",
# "score_interno" removido de propósito
"valor_solicitado",
"num_parcelas",
"tipo_renda",
"possui_restricao",
],
"data": [
[34, 4200.0, 5.0, 12000.0, 24, "CLT", "nao"],
],
},
"params": {
"threshold": 0.3,
},
}
response = requests.post(
url,
headers={"Content-Type": "application/json"},
data=json.dumps(payload_invalido),
timeout=30,
)
print("Status code:", response.status_code)
print(response.text)