Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Setup #19

Merged
merged 4 commits into from
Aug 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ config.ini
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
/all_meetings.json

# Virtual Environment
/venv
56 changes: 29 additions & 27 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ def get_eventbrite_venues(events_list):
venue_ids = list(set(venue_ids))
venues = []
for venue_id in venue_ids:
url = 'https://www.eventbriteapi.com/v3/venues/{}/'.format(venue_id)
r = requests.get(url, headers={"Authorization": "Bearer {}".format(token)}, verify=True)
# if r.status_code != 200:
# raise Exception('Could not connect to Eventbrite API at {}. Status Code: {}'.format(url, r.status_code))
data = json.loads(r.text)
venues.append(data)
if venue_id != None: # Catch exception if venue id not properly supplied
url = 'https://www.eventbriteapi.com/v3/venues/{}/'.format(venue_id)
r = requests.get(url, headers={"Authorization": "Bearer {}".format(token)}, verify=True)
if r.status_code != 200:
raise Exception('Could not connect to Eventbrite API at {}. Status Code: {}'.format(url, r.status_code))
data = json.loads(r.text)
venues.append(data)
return venues


Expand All @@ -160,27 +161,28 @@ def format_eventbrite_events(events_list, venues_list, group_list):
venues[venue_id] = venue_dict

for event in events_list:
group_item = [i for i in group_list if i['field_events_api_key'] == event.get('organizer_id')][0]
group_name = group_item.get('title')
tags = group_item.get('field_org_tags')
uuid = group_item.get('uuid')
nid = group_item.get('nid')
event_dict = {
'event_name': event.get('name').get('text'),
'group_name': group_name,
'venue': venues[event.get('venue_id')],
'url': event.get('url'),
'time': event.get('start').get("utc"),
'tags': tags,
'rsvp_count': None,
'created_at': event.get('created'),
'description': event.get('description').get('text'),
'uuid': uuid,
'nid': nid,
'data_as_of': datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ'),
'status': event.get('status')
}
events.append(event_dict)
if type(event.get('venue_id')) == str: # If venue id error
group_item = [i for i in group_list if i['field_events_api_key'] == event.get('organizer_id')][0]
group_name = group_item.get('title')
tags = group_item.get('field_org_tags')
uuid = group_item.get('uuid')
nid = group_item.get('nid')
event_dict = {
'event_name': event.get('name').get('text'),
'group_name': group_name,
'venue': venues[event.get('venue_id')],
'url': event.get('url'),
'time': event.get('start').get("utc"),
'tags': tags,
'rsvp_count': None,
'created_at': event.get('created'),
'description': event.get('description').get('text'),
'uuid': uuid,
'nid': nid,
'data_as_of': datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ'),
'status': event.get('status')
}
events.append(event_dict)
return events


Expand Down
2 changes: 1 addition & 1 deletion update_cal_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/home/ubuntu/miniconda2/envs/cal_service/bin/python
##!/home/ubuntu/miniconda2/envs/cal_service/bin/python
# encoding: utf-8
import app
import simplejson as json
Expand Down