-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget_event_data.py
More file actions
61 lines (53 loc) · 1.92 KB
/
get_event_data.py
File metadata and controls
61 lines (53 loc) · 1.92 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from event_count import Total
import requests
from event_class import Event
from date_time import today
value = Total
BASE_URL = "https://owllife.kennesaw.edu/api/discovery/event/search"
parameters = {
"endsAfter": today,
"orderByField": "endsOn",
"orderByDirection": "ascending",
"status": "Approved",
"take": value,
"query": "",
}
base_url = 'https://owllife.kennesaw.edu/api/discovery/event/search?endsAfter={' '}' \
'&orderByField=endsOn&orderByDirection=ascending&status=Approved&take={' \
'}'.format(
today,
value)
response = requests.get(base_url).json()
#print(response)
def get_json_events(r):
e = []
for item in r['value']:
id = item['id']
organizationName = item['organizationName']
organizationNames = item['organizationNames']
name = item['name']
description = item['description']
location = item['location']
startsOn = item['startsOn']
endsOn = item['endsOn']
theme = item['theme']
categoryNames = item['categoryNames']
benefitNames = item['benefitNames']
institutionId = item['institutionId']
organizationId = item['organizationId']
organizationIds = item['organizationIds']
organizationProfilePicture = item['organizationProfilePicture']
branchId = item['branchId']
imagePath = item['imagePath']
visibility = item['visibility']
status = item['status']
searchScore = item['@search.score']
ev = Event(id, organizationName, organizationNames, name,
description, location, startsOn, endsOn, theme,
categoryNames,
benefitNames, institutionId, branchId, organizationIds, organizationProfilePicture,
organizationId, status,
imagePath, visibility, searchScore)
e.append(ev)
return e
events = get_json_events(response)