-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate.py
30 lines (29 loc) · 1 KB
/
template.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
import os
import scraperwiki
from bs4 import BeautifulSoup
from datetime import datetime
from dateutil.parser import parse
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
os.environ["SCRAPERWIKI_DATABASE_NAME"] = "sqlite:///data.sqlite"
applications_url = 'https://www'
html = scraperwiki.scrape(applications_url)
date_scraped = datetime.now().isoformat()
page = BeautifulSoup(html, 'html.parser')
das = page.find('table')('tr')[1:]
for da in das:
council_reference = ''
address = '' + ', Tasmania, Australia'
description = ''
info_url = '' # .('a')['href']
on_notice_to = parse('1 jan 2020').strftime('%Y-%m-%d')
record = {
'council_reference': council_reference,
'address': address,
'description': description,
'info_url': info_url,
'date_scraped': date_scraped,
'on_notice_to': on_notice_to
}
logging.debug(record)
scraperwiki.sqlite.save(unique_keys=['council_reference'], data=record, table_name="data")