Mercurial > public > finance-parser
comparison get_tickers/app.py @ 7:7c5fb7573dd8
first working version
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Mon, 05 Jun 2023 19:06:34 +0100 |
parents | get_report/app.py@2daf0dc08247 |
children | ab988fd1e6fa |
comparison
equal
deleted
inserted
replaced
6:d15ccf5f1373 | 7:7c5fb7573dd8 |
---|---|
1 import json | |
2 import boto3 | |
3 from boto3.dynamodb.conditions import Key | |
4 | |
5 resource = boto3.resource('dynamodb') | |
6 table = resource.Table('FinanceParser') | |
7 | |
8 | |
9 def lambda_handler(event, context): | |
10 response = table.scan( | |
11 FilterExpression=Key('pk').begins_with('file') | |
12 ) | |
13 | |
14 return { | |
15 "statusCode": 200, | |
16 "headers": { | |
17 "Access-Control-Allow-Headers": "Content-Type", | |
18 "Access-Control-Allow-Origin": "*", | |
19 "Access-Control-Allow-Methods": "GET" | |
20 }, | |
21 "body": json.dumps({ | |
22 "message": { | |
23 "items": response['Items'], | |
24 "count": len(response['Items']) | |
25 } | |
26 }), | |
27 } |