Skip to content

Instantly share code, notes, and snippets.

@DerekHawkins
Created June 10, 2022 14:26
Show Gist options
  • Save DerekHawkins/a26cc4e4ffb581a8e5b8a8e52bd0037b to your computer and use it in GitHub Desktop.
Save DerekHawkins/a26cc4e4ffb581a8e5b8a8e52bd0037b to your computer and use it in GitHub Desktop.
# Ping the CVENT API and parse the JSON
# (sort in descending order to place the most recent registrants at the top of the JSON output
r = requests.get(f'https://api-platform.cvent.com/ea/attendees?sort=registeredAt:DESC', headers=call_headers)
frame = []
for crawl in r.json()['data']:
_id = crawl['id']
full_name = f"{crawl['contact']['firstName']} {crawl['contact']['lastName']}"
email_address = crawl['contact']['email']
try:
company_name = crawl['contact']['company']
except KeyError as e:
company_name = 'N/A'
title = crawl['contact']['title']
registration_type = crawl['registrationType']['name']
registered_at = crawl['registeredAt']
cvent_data = {'id':_id,
'event_id':crawl['event']['id'],
'full_name':full_name,
'email_address':email_address,
'company_name':company_name,
'title':title,
'registration_type':registration_type,
'registeredAt':registered_at}
frame.append(cvent_data)
# Put into a dataframe and filter it
cvent_df = pd.DataFrame(frame)
cvent_main = cvent_df[(cvent_df['event_id']==rev_id) & \
~(cvent_df['email_address'].str.contains('|'.join(['dominodatalab', '---']))) & \
~(cvent_df['company_name'].str.contains('|'.join(['', 'Domino', '--',
'---', '---',
'--', 'N/A', '--', '-', '--', ' ---'])))].reset_index(drop=True).drop_duplicates()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment