Created
July 17, 2012 23:53
-
-
Save ryanj/3133006 to your computer and use it in GitHub Desktop.
Eventbrite - convert a repeating event to an Organizer Schedule
This file contains 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 | |
your_app_key = 'YOUR_APP_KEY_HERE' | |
your_user_key = 'YOUR_USER_KEY_HERE' | |
repeating_event_eid = 3919635736 | |
eb_client = eventbrite.EventbriteClient({'app_key': your_app_key, 'user_key': your_user_key}) | |
def convert_repeat_to_organizer_schedule(evnt): | |
#clear existing repeat_schedule | |
eb_client.event_update({'id': evnt['id'], 'repeat_schedule': 'clear'}) | |
#for each repeat, copy and update | |
for repeating_date in evnt['repeat_schedule']: | |
new_event_resp = eb_client.event_copy({'id': evnt['id'], 'title': evnt['title']+" "+repeating_date['start_date']}) | |
eb_client.event_update({'id': new_event_resp['process']['id'], 'start_date': repeating_date['start_date'],'end_date':repeating_date['end_date'],'status':'live'}) | |
eb_client.event_update({'id': evnt['id'], 'status': 'draft'}) | |
evnt = eb_client.event_get({'id':repeating_event_eid, 'display':'repeat_schedule'}) | |
if evnt['event']['repeats'] == 'yes' and evnt['event']['repeat_schedule'] and type([]) == type(evnt['event']['repeat_schedule']): | |
convert_repeat_to_organizer_schedule(evnt['event']) | |
else: | |
print "this event is not a repeating event" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment