-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Expand file tree
/
Copy pathinvoke.py
More file actions
37 lines (33 loc) · 959 Bytes
/
invoke.py
File metadata and controls
37 lines (33 loc) · 959 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
import boto3
import json
lambda_client = boto3.client('lambda')
customer_data = {
"customer": {
"gender": "female",
"seniorcitizen": 0,
"partner": "yes",
"dependents": "no",
"phoneservice": "no",
"multiplelines": "no_phone_service",
"internetservice": "dsl",
"onlinesecurity": "no",
"onlinebackup": "yes",
"deviceprotection": "no",
"techsupport": "no",
"streamingtv": "no",
"streamingmovies": "no",
"contract": "month-to-month",
"paperlessbilling": "yes",
"paymentmethod": "electronic_check",
"tenure": 1,
"monthlycharges": 29.85,
"totalcharges": 29.85
}
}
response = lambda_client.invoke(
FunctionName='churn-prediction-docker',
InvocationType='RequestResponse',
Payload=json.dumps(customer_data)
)
result = json.loads(response['Payload'].read())
print(json.dumps(result, indent=2))