Last active
December 25, 2015 00:39
-
-
Save Qalthos/6889584 to your computer and use it in GitHub Desktop.
eventbrite grab attendees
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eventbrite | |
eb_tokens = dict(app_key='APPLICATION_KEY') | |
eb_cl = eventbrite.EventbriteClient(eb_tokens) | |
response = eb_cl.event_list_attendees(dict(id='8645022495', | |
only_display='first_name,last_name,answers')) | |
attendees = list() | |
for a_dict in response['attendees']: | |
a_dict = a_dict['attendee'] | |
attendee = dict(first_name=a_dict['first_name'], | |
last_name=a_dict['last_name']) | |
for an_dict in a_dict['answers']: | |
an_dict = an_dict['answer'] | |
if an_dict['question'] == 'Twitter': | |
key = 'twitter' | |
else: | |
key = 'topic' | |
attendee[key] = an_dict['answer_text'] | |
attendees.append(attendee) | |
with open('attendees.yaml', 'w') as yamlfile: | |
yaml.dump(attendees, yamlfile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yay!