bsmsapp/terraform/resources/lambda/lambdaGET/lambda_handler.py

28 lines
612 B
Python

import json
import boto3
import requests
import os
def main(event, context):
print(event)
record = event['Records'][0]
print(record)
sqs_message = json.dumps(event)
print(sqs_message)
body = record["body"]
body = body.replace('\n', '')
body = json.loads(body)
query = body["body-json"]
print(query)
response = requests.get("http://api.slococo.com.ar:2555/api/items?user=" + query["username"] + "&id=" + str(query["id"]))
print(response.json())
response = response.json()
if response["stock"] != query["stock"]:
raise 'Error'
return event