-
Notifications
You must be signed in to change notification settings - Fork 0
/
cor.py
38 lines (30 loc) · 1.21 KB
/
cor.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
import requests
from bs4 import BeautifulSoup
class Meeting:
date = ''
canceled = True
agenda = ''
def __init__(self, date, agenda, canceled):
self.date = date
self.agenda = agenda
self.canceled = canceled
def __str__(self):
if self.canceled:
return "Date: " + self.date + " | No Meeting"
else:
return "Date: " + self.date + " | Agenda: " + self.agenda
def get_meeting(table_i=0):
# Get recent meeting table row
resp = requests.get('https://www.cor.net/government/boards-commissions-meetings/city-council/city-council-regular-meeting-documents',
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:130.0) Gecko/20100101 Firefox/130.0'})
bs = BeautifulSoup(resp.text, 'html.parser')
table_rows = bs.find_all('tr', class_='govAccess-reTableOddRow-4')
recent = table_rows[table_i]
# Create meeting object with agenda if meeting not canceled
canceled = False
agenda = ''
if recent.contents[3].string == 'No Meeting':
canceled = True
else:
agenda = recent.contents[3].a['href']
return Meeting(recent.contents[1].string, agenda, canceled)