-
Notifications
You must be signed in to change notification settings - Fork 0
/
handler.py
45 lines (36 loc) · 1.04 KB
/
handler.py
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
import json
from scraper.models import Session, Job
def hello(event, context):
body = {
"message": "Go Serverless v1.0! Your function executed successfully!",
"input": event
}
response = {
"statusCode": 200,
"body": json.dumps(body)
}
return response
# Use this code if you don't use the http event with the LAMBDA-PROXY
# integration
"""
return {
"message": "Go Serverless v1.0! Your function executed successfully!",
"event": event
}
"""
def testPg(event, context):
session = Session()
ids = [j.job_id for j in session.query(Job.job_id).filter_by(site="baunetz").order_by(Job.job_id)]
print(ids)
# session.close()
print("Got existing IDS in DB, to avoid saving duplicates... [" + str(len(ids)) + "]")
# return ids
body = {
"message": "Go Serverless v1.0! Your function executed successfully!",
"input": event
}
response = {
"statusCode": 200,
"body": json.dumps(ids)
}
return response