-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda.py
More file actions
32 lines (22 loc) · 990 Bytes
/
lambda.py
File metadata and controls
32 lines (22 loc) · 990 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
from __future__ import print_function
import json
import boto3
from botocore.vendored import requests
print('Loading function')
def lambda_handler(event, context):
response = requests.post('https://mainnet.infura.io/v3/your-infura-id', json={"jsonrpc":"2.0","method":"eth_getBalance","params": ["your-wallet-address", "latest"],"id":1})
print("Status code: ", response.status_code)
print("Response:")
print(response.json())
time.sleep(100)
response = requests.post('https://mainnet.infura.io/v3/your-infura-id', json={"jsonrpc":"2.0","method":"eth_getBalance","params": ["your-wallet-address", "latest"],"id":1})
print("Status code: ", response.status_code)
print("Response:")
print(response.json())
client = boto3.client('iot-data', region_name='us-east-1')
# Change topic, qos and payload
response = client.publish(
topic='test/topic',
qos=1,
payload=json.dumps({"message:":"FR1"})
)