-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandler.py
More file actions
33 lines (24 loc) · 768 Bytes
/
handler.py
File metadata and controls
33 lines (24 loc) · 768 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
import os
import logging
import uuid
from scraper import Scraper
from tee_times import TeeTimes
from helpers import *
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def scrape_times(event, context):
url = 'https://cityofla.ezlinksgolf.com/index.html#/search'
logger.info('## ENVIRONMENT VARIABLES')
logger.info(os.environ)
screenshot_file = "{}-{}".format(''.join(filter(str.isalpha, url)), str(uuid.uuid4()))
driver = Scraper()
logger.info('Scrape EZ Links')
results = driver.scrape(url, '/tmp/{}-full.png'.format(screenshot_file))
driver.close()
t = TeeTimes(results, results_filename())
t.upload()
response = {
"statusCode": 200,
"body": results
}
return response