Пример #1
1
def parseEventbrite(organizer):
	eventbrite = Eventbrite(config.EVENTBRITE_OAUTH_TOKEN)
	events = eventbrite.event_search(**{'organizer.id': organizer})

	event_list = []
	venues = {}

	for event in events["events"]:
		event_data = {
			"title": event["name"]["text"],
			"start": event["start"]["local"],
			"end": event["end"]["local"],
			"url": event["url"]
		}

		try:
			event_data["description"] = event["description"]["text"]
		except AttributeError:
			pass

		venue_id = event["venue_id"]
		try:
			venue_str = venues[venue_id]
		except KeyError:
			venue = eventbrite.get("/venues/%s" % venue_id)
			venue_str = "%s, %s, %s %s" % (venue["name"], venue["address"]["address_1"], venue["address"]["postal_code"], venue["address"]["city"])
			venues[venue_id] = venue_str

		event_data["location"] = venue_str

		event_list.append(event_data)

	return event_list
Пример #2
0
def detail(request): 
    #used to store the categorized events in one list
    categoryCodes = []
    #iterate through the choices selected in indexi
    if len(request.GET) == 3:
        Events.objects.all().delete()
        print(Events.objects.all())
        events_list = Events.objects.all()
        for x in request.GET.iteritems():
            categoryCodes.append(x[0])
            print(x[0])
        #eventbrite oAuth
        eventbrite = Eventbrite('BBHTDWKYZZV5YJZB4DTF')
        print("/events/search/?categories={!s},{!s},{!s}&token=BBHTDWKYZZV5YJZB4DTF".format(categoryCodes[0], categoryCodes[1], categoryCodes[2]))
        #grabs events from page count from a given category
        events = eventbrite.get("/events/search/?categories={!s},{!s},{!s}&token=BBHTDWKYZZV5YJZB4DTF".format(categoryCodes[0], categoryCodes[1], categoryCodes[2]))
        #51
        for y in xrange(events['pagination']['page_count']):
            events = eventbrite.get("/events/search/?page={!s}&categories={!s},{!s},{!s}".format(y,categoryCodes[0], categoryCodes[1], categoryCodes[2]))
            print(events.pretty)
            #iterate through 50 because there's only 50 per page
            for x in xrange(events['pagination']['page_size']):
                e = Events(name = events['events'][x]['name']['text']) 
                e.save()
    #setting up pagination
        print(Events.objects.all())
    elif len(request.GET) == 1:
        pass
    else:
        Events.objects.all().delete()
    return setUpPage(request,Events)
Пример #3
0
def create_webhook(token):
    data_order = {
        'endpoint_url': URL_ENDPOINT_ORDER,
        'actions': WH_ORDER_ACTION,
    }
    data_check_in = {
        'endpoint_url': URL_ENDPOINT_CHECK_IN,
        'actions': WH_CHECK_IN_ACTION,
    }
    response_order = Eventbrite(token).post('/webhooks/', data_order)
    response_check_in = Eventbrite(token).post('/webhooks/', data_check_in)
    return (response_order.get('id', None), response_check_in.get('id', None))
Пример #4
0
def detail(request): 
    #used store the category codes
    categoryCodes = []
    #used to check if within a page
    pagesCheck = []
    #iterate through the choices selected in indexi
    for x in request.GET.iteritems():
        pagesCheck.append(x[0])
        #error checking print
        print(pagesCheck[0])
    #if three things in get, then grab selected categories
    if len(request.GET) == 3:
        #make sure the previous database is removed
        Events.objects.all().delete()
        #check to see if delete was successful
        print(Events.objects.all())
 
        events_list = Events.objects.all()
        #separating category codes
        for x in request.GET.iteritems():
            categoryCodes.append(x[0])
            #error checking print
            print(x[0])
        #eventbrite oAuth
        eventbrite = Eventbrite('BBHTDWKYZZV5YJZB4DTF')
        print("/events/search/?categories={!s},{!s},{!s}&token=BBHTDWKYZZV5YJZB4DTF".format(categoryCodes[0], categoryCodes[1], categoryCodes[2]))
        #grabs events from page count from a given category
        events = eventbrite.get("/events/search/?categories={!s},{!s},{!s}&token=BBHTDWKYZZV5YJZB4DTF".format(categoryCodes[0], categoryCodes[1], categoryCodes[2]))
        #51
        for y in xrange(events['pagination']['page_count']):
        #test for to make sure it's working. ^ takes a long time to get everything
        #for x in xrange(1):
            events = eventbrite.get("/events/search/?page={!s}&categories={!s},{!s},{!s}".format(1,categoryCodes[0], categoryCodes[1], categoryCodes[2]))
            #more error checking prints
            print(events.pretty)
            #iterate through 50 because there's only 50 per page
            for x in xrange(events['pagination']['page_size']):
                e = Events(name = events['events'][x]['name']['text']) 
                e.save()
    #setting up pagination
        print(Events.objects.all())
    elif len(request.GET) == 1 and pagesCheck[0] == "page":
        pass
    elif len(request.GET) > 3:
        raise Http404("Too many selections selected")
    elif len(request.GET) < 3:
        raise Http404("Too few selections selected")
    else:
        #delete database again just to be sure
        Events.objects.all().delete()
        return index(request)
    return setUpPage(request)
Пример #5
0
def parseEventbrite(organizer):
    eventbrite = Eventbrite(config.EVENTBRITE_OAUTH_TOKEN)
    events = eventbrite.event_search(**{'organizer.id': organizer})

    event_list = []
    venues = {}

    for event in events["events"]:
        event_data = {
            "title": event["name"]["text"],
            "start": event["start"]["local"],
            "end": event["end"]["local"],
            "url": event["url"]
        }

        try:
            event_data["description"] = event["description"]["text"]
        except AttributeError:
            pass

        venue_id = event["venue_id"]
        try:
            venue_str = venues[venue_id]
        except KeyError:
            venue = eventbrite.get("/venues/%s" % venue_id)
            venue_str = "%s, %s, %s %s" % (
                venue["name"], venue["address"]["address_1"],
                venue["address"]["postal_code"], venue["address"]["city"])
            venues[venue_id] = venue_str

        event_data["location"] = venue_str

        event_list.append(event_data)

    return event_list
Пример #6
0
 def get_events(self):
     social = self.request.user.social_auth.filter(provider='eventbrite')[0]
     token = social.access_token
     eventbrite = Eventbrite(token)
     events = eventbrite.get('/users/me/events/')
     if not events['events']:
         return empty_response
     return events['events']
Пример #7
0
def get_api_events_org(token, organization, page_number=None):
    """
    Get events of one organization from the user of the token from the api
    """
    eventbrite = Eventbrite(token)
    if page_number == None:
        page_number = 1
    api_query = eventbrite.get('/organizations/{}/events/?page={}'.format(
        organization['id'], page_number))
    return api_query.get('events'), api_query.get('pagination')
Пример #8
0
    def handle(self, *args, **options):
        eventtoken = os.environ.get('EVENTBRITE_TOKEN')
        eventbrite = Eventbrite(eventtoken)

        event_ID = input(
            "Please enter the ID of the event you would like to manually add: "
        )

        api_object = eventbrite.get("/events/{0}".format(event_ID))
        #print(api_object.pretty)
        #get the api_url to avoid an error
        api_url = api_object['resource_uri']

        #parse time because dates are horrible
        start_time = parse_datetime(api_object['start']['local'])

        #find which kind of event it is
        #get first 3 characters of event name
        name_code = api_object['name']['html'][0:3]
        name_code = name_code.lower()

        print('do you want to add the following event? \n Title: ',
              api_object['name']['html'], '\n Start Date:', start_time,
              '\n Y/N')

        decision = input().lower()

        if decision == 'y':
            print("adding...")

            def add_event(code):
                #todo: import this function from isa_website/views
                new_event = Event(api_url=api_url,
                                  event_start=start_time,
                                  title=api_object['name']['html'],
                                  event_url=api_object['url'],
                                  event_code=code)
                new_event.save()

            #now loop to put event in correct category
            if name_code == "cor":
                add_event("core")
            elif name_code == "int":
                add_event("inter")
            elif name_code == "hig":
                add_event("higher")
            elif name_code == "fd ":
                #skip faculty development events
                pass
            else:
                add_event("other")
        else:
            print("ok thx bye")
Пример #9
0
 def get_events(self):
     list_events = []
     # user_logged = True
     try:
         social = self.request.user.social_auth.all()[0]
         token = social.access_token
         eventbrite = Eventbrite(token)
         list_events = eventbrite.get('/users/me/events/')['events']
         return list_events
     except:
         # user_logged = False
         return list_events
Пример #10
0
def get_api_order_attendees(token, order_id):
    eventbrite = Eventbrite(token)
    result = []
    page = 1
    continuation = True
    while (continuation):
        url = '/orders/{}/attendees/?page={}'.format(order_id, page)
        call = eventbrite.get(url, expand=('merchandise', ))
        result.extend(call.get('attendees'))
        page += 1
        continuation = has_continuation(call)
    return result
Пример #11
0
def eventbrite_request():

    from eventbrite import Eventbrite

    eventbrite = Eventbrite('MYSECRETKEY')
    data = {
        'location.address': 94025,
        'q': 'goat+yoga',
    }
    events = eventbrite.get('/events/search/', data=data)

    return events
Пример #12
0
 def get_events(self, user):
     try:
         eventbrite = Eventbrite(user.access_token)
         page_number = self.request.GET[
             'page'] if 'page' in self.request.GET else 1
         events = eventbrite.get(
             '/users/me/events?page_size={}&page={}'.format(
                 self.paginate_by,
                 page_number,
             ))
         return events
     except AttributeError:
         return {'pagination': {'object_count': 0}, 'events': []}
    def handle(self, *args, **options):
        eventbrite = Eventbrite(generic_keys.eventbrite_oauth_token)
        # for getting all the events from washington DC
        # **{'venue.city': 'new york'}
        nyc_events = []
        for i in range(2, 500):
            try:
                nyc_events = eventbrite.event_search(**{'page': i})['events']
            except:
                pass
            for line in nyc_events:
                event_name, event_description, event_website, event_image, start_date, start_time, end_date, end_time, event_address, event_faq, phone_number = '', '', '', '', '', '', '', '', '', '', ''
                try:
                    event_name = line['name']['text']
                    event_description = line['description']['text']
                except:
                    pass
                try:
                    event_website = line['url']
                    event_image = line['logo']['url']
                except:
                    pass
                try:
                    start_time = line['start']['local'].split('T')[1]
                    start_date = line['start']['local'].split('T')[0]
                    end_time = line['end']['local'].split('T')[1]
                    end_date = line['end']['local'].split('T')[0]
                except:
                    pass
                try:
                    event_address = eventbrite.get('/venues/{}/'.format(
                        line['venue_id']))['address']['address_1']
                except Exception as e:
                    print e

                try:
                    Activity.objects.create(
                        event_name=event_name,
                        event_location=event_address,
                        event_address=event_address,
                        event_website=event_website,
                        event_description=event_description,
                        event_image=event_image,
                        start_time=start_time,
                        end_time=end_time,
                        start_date=start_date,
                        end_date=end_date,
                        event_faq=event_faq)
                except Exception as e:
                    print e
Пример #14
0
def detail(request):
    #used to store the categorized events in one list
    categoryCodes = []
    #iterate through the choices selected in indexi
    if len(request.GET) == 3:
        Events.objects.all().delete()
        print(Events.objects.all())
        events_list = Events.objects.all()
        for x in request.GET.iteritems():
            categoryCodes.append(x[0])
            print(x[0])
        #eventbrite oAuth
        eventbrite = Eventbrite('BBHTDWKYZZV5YJZB4DTF')
        print(
            "/events/search/?categories={!s},{!s},{!s}&token=BBHTDWKYZZV5YJZB4DTF"
            .format(categoryCodes[0], categoryCodes[1], categoryCodes[2]))
        #grabs events from page count from a given category
        events = eventbrite.get(
            "/events/search/?categories={!s},{!s},{!s}&token=BBHTDWKYZZV5YJZB4DTF"
            .format(categoryCodes[0], categoryCodes[1], categoryCodes[2]))
        #51
        for y in xrange(events['pagination']['page_count']):
            events = eventbrite.get(
                "/events/search/?page={!s}&categories={!s},{!s},{!s}".format(
                    y, categoryCodes[0], categoryCodes[1], categoryCodes[2]))
            print(events.pretty)
            #iterate through 50 because there's only 50 per page
            for x in xrange(events['pagination']['page_size']):
                e = Events(name=events['events'][x]['name']['text'])
                e.save()
    #setting up pagination
        print(Events.objects.all())
    elif len(request.GET) == 1:
        pass
    else:
        Events.objects.all().delete()
    return setUpPage(request, Events)
Пример #15
0
def get_api_orders_of_event(token, event_id):
    """
    Get organization from the user of the token from the api
    """
    eventbrite = Eventbrite(token)
    result = []
    page = 1
    continuation = True
    while (continuation):
        url = '/events/{}/orders/?page={}'.format(event_id, page)
        call = eventbrite.get(url, expand=('merchandise', ))
        result.extend(call.get('orders'))
        page += 1
        continuation = has_continuation(call)
    return result
Пример #16
0
def tod_events(search_args, category, am_end, pm_st):
    eventbrite = Eventbrite(keys["eventbrite_key"])
    events = eventbrite.event_search(**search_args)
    ## Use this for filtering
#     events = [x for x in events['events'] if x['category_id'] == "103"]

    events = [x for x in events['events']]

    for item in events:
        location_id = eventbrite.get('/venues/' + str(item['venue_id']))
        item.update( {"latitude": location_id['latitude']})
        item.update( {"longitude": location_id['longitude']})
        item.update( {"address": location_id['address']})

    return events
Пример #17
0
def get_events(location, search_input):

    search_list = search_input.split()
    search_terms = "+".join(search_list)

    from eventbrite import Eventbrite
    eventbrite = Eventbrite('YHXAIYNKIL7WNRQDO4LX')

    data = {
        'location.address': location,
        'q': search_terms,
    }

    events = eventbrite.get('/events/search/', data=data)

    return events
Пример #18
0
def get_om_events(request):
    from django.conf import settings
    from eventbrite import Eventbrite
    eventbrite = Eventbrite(settings.ITA_API_KEY)
    try:
        ita_events = eventbrite.get('/users/me/owned_events')
        return JsonResponse({
            'status': 'ok',
            'results': {
                'italy': ita_events
            }
        },
                            status=200)
    except Exception as e:
        print(e.message)
        return JsonResponse({'status': 'error', 'results': {}}, status=500)
Пример #19
0
def eventbrite(request):
    eventbrite = Eventbrite(eventtoken)

    data = request.body.decode('utf-8')
    data = json.loads(data)

    api_url = data['api_url']

    try:
        api_object = eventbrite.get(api_url)
        print(api_object.pretty)

        start_time = parse_datetime(api_object['start']['local'])

        #find which kind of event it is
        #get first 3 characters of event name ISA Intermediate Training Day
        name_code = api_object['name']['html'][4:7]
        name_code = name_code.lower()

        def add_event(code):
            #ToDo: make sure event isn't already in db
            new_event = Event(api_url=api_url,
                              event_start=start_time,
                              title=api_object['name']['html'],
                              event_url=api_object['url'],
                              event_code=code)
            new_event.save()

        #now loop to put event in correct category
        if name_code == "cor":
            add_event("core")
        elif name_code == "int":
            add_event("inter")
        elif name_code == "hig":
            add_event("higher")
        elif name_code == "fd ":
            #skip faculty development events
            pass
        else:
            add_event("other")

        return HttpResponse("webhook received by ISA")

    except:
        print("bad api url")
        return HttpResponseBadRequest("bad api url")
    def handle(self, *args, **options):
        eventbrite = Eventbrite(generic_keys.eventbrite_oauth_token)
        # for getting all the events from washington DC
        # **{'venue.city': 'new york'}
        nyc_events = []
        for i in range(2, 500):
            try:
                nyc_events = eventbrite.event_search(**{'page': i})['events']
            except:
                pass
            for line in nyc_events:
                event_name, event_description, event_website, event_image, start_date, start_time, end_date, end_time, event_address, event_faq, phone_number = '', '', '', '', '', '', '', '', '', '', ''
                try:
                    event_name = line['name']['text']
                    event_description = line['description']['text']
                except:
                    pass
                try:
                    event_website = line['url']
                    event_image = line['logo']['url']
                except:
                    pass
                try:
                    start_time = line['start']['local'].split('T')[1]
                    start_date = line['start']['local'].split('T')[0]
                    end_time = line['end']['local'].split('T')[1]
                    end_date = line['end']['local'].split('T')[0]
                except:
                    pass
                try:
                    event_address = eventbrite.get('/venues/{}/'.format(line['venue_id']))['address']['address_1']
                except Exception as e:
                    print e

                try:
                    Activity.objects.create(event_name=event_name, event_location=event_address, event_address=event_address, event_website=event_website, event_description=event_description, event_image=event_image, start_time=start_time, end_time=end_time, start_date=start_date, end_date=end_date, event_faq=event_faq)
                except Exception as e:
                    print e
    def find_events(self, query_params: Dict[str, Any]) -> Dict[str, Any]:
        """
        Fetch the content from url

        Args:
            url: url of /organizations/{organization_id}/events?{params}

        Returns:
            response body in python native form


        Example requests:
            * /organizations/350577373737/events?page_size=200&status=live
        """

        eventbrite = Eventbrite(self.api_key)

        all_events = []
        for key in orgs:

            # TODO: This doesn't work for any other organization than Roaring Fork Technologists because oauth2 needs to be setup.
            # 200 is the max page_size
            url = '/organizations/' + orgs[
                key] + '/events?page_size=200&status=live'
            resp = eventbrite.get(url)

            pagination_props = resp['pagination']
            events = resp['events']

            if (len(events) > 0):
                all_events.extend(events)

            if (pagination_props['has_more_items'] is True):
                print("There are more events which we can ignore for now...")

        return all_events
Пример #22
0
def get_api_events_id(token, event_id):
    """
    Get events from the user of the token from the api
    """
    eventbrite = Eventbrite(token)
    return eventbrite.get('/events/{}'.format(event_id))
Пример #23
0
def get_recommendation(desired_time):
    # GET EVENT RECOMMENDATION FROM EVENTBRITE

    # GET EVENTBRITE API KEY
    eventbrite_api_key = get_key('EVENTBRITE_TOKEN')
    eventbrite = Eventbrite(eventbrite_api_key)

    # GET ADDRESS FROM HOTEL NAME (GOOGLEMAPS)
    google_api_key = get_key('GOOGLE')
    gmaps = googlemaps.Client(key=google_api_key)
    places_result = gmaps.places(query=session.attributes['hotel'])
    hotel_address = [e['formatted_address'] for e in places_result['results']]

    # GET CATEGORY ID FROM CATEGORY NAME
    address = hotel_address
    category_input = 'Music'
    subcategory_input = session.attributes['music_cat_id']
    location_radius = '10mi'
    event_timing = desired_time
    categoryquery = eventbrite.get_categories()

    category_name = [c['name'] for c in categoryquery['categories']]
    category_ids = [c['id'] for c in categoryquery['categories']]
    categories = zip(category_name, category_ids)

    category_id = None
    for x in categories:
        if x[0] == category_input:
            category_id = x[1]

    # GET SUBCATEGORY ID FROM CATEGORY ID
    #subcategoryquery = eventbrite.get_subcategories()

    #subcategory_name = [c['name'] for c in subcategoryquery['subcategories']]
    #subcategory_ids = [c['id'] for c in subcategoryquery['subcategories']]
    #subcategories = zip(subcategory_name, subcategory_ids)

    subcategory_id = subcategory_input
    #for x in subcategories:
        #if x[0] == subcategory_input:
            #subcategory_id = x[1]

    # GET LIST OF EVENTS
    eventquery = eventbrite.event_search(**{'location.address': address,
                                            'categories': category_id,
                                            'subcategories': subcategory_id,
                                            'location.within': location_radius,
                                            'start_date.keyword': event_timing})

    eventnames = [e['name']['text'] for e in eventquery['events']]
    if not eventnames:
        return False
    event1 = eventnames[0]

    eventdescr = [e['description']['text'] for e in eventquery['events']]
    descr1 = eventdescr[0]

    # COLLECT ADDITIONAL INFO FOR FILES
    #eventdescr2 = []
    #for i in eventdescr:
        #if i is None:
            #eventdescr2.append("")
        #eventdescr2.append(((i.replace("\n", " ")).replace("\r", " "))[0:30])

    eventlogo = []
    for e in eventquery['events']:
        eventlogo.append(e['logo']['original']['url'] if e['logo'] else '')
    logo1 = eventlogo[0]

    eventkeys = []
    for i in eventnames:
        eventkeys.append(('event-' + i).replace(" ", "-"))

    eventlist = zip(eventkeys, eventnames, eventnames, eventlogo)

    eventstart = [l['local']
                  for l in (e['start'] for e in eventquery['events'])]
    start1 = eventstart[0]

    eventend = [l['local'] for l in (e['end'] for e in eventquery['events'])]
    end1 = eventend[0]

    eventvenue = [v['venue_id'] for v in eventquery['events']]
    venue1 = eventvenue[0]
    venuequery = eventbrite.get('/venues/{0}'.format(venue1))
    venue_list = venuequery['address']['localized_multi_line_address_display']
    venue_string = " ".join(str(x) for x in venue_list)

    eventurl = [u['url'] for u in eventquery['events']]
    url1 = eventurl[0]

    # CREATE EVENT TERMS

    eventterms = []
    for i in eventnames:
        eventterms.append((((category_input + '__' + session.attributes['music_cat']).replace(" ", "_")).replace("/", "and")).lower())

    termfile = zip(eventkeys, eventterms)
    with get_connection() as conn:
        with conn.cursor() as cursor:
            cursor.executemany("""
                INSERT INTO products (id, name, description, image_link)
                VALUES (%s, %s, %s, %s)
                """, eventlist)
            cursor.executemany("""
                INSERT INTO terms (event_key, event_term) VALUES (%s, %s)
                """, termfile)
    conn.close()

    # TEXT EVENT DETAILS

    account_sid = get_key('TWILIO_SID')
    auth_token = get_key('TWILIO_TOKEN')

    client = twilio.rest.Client(account_sid, auth_token)

    phone_number = session.attributes['phone_number']
    client.messages.create(
        to=phone_number,
        from_=get_key('TWILIO_PHONE'),
        body="Your IHG Concierge has sent you an event you may enjoy: " +
             '\n' + event1 + '\n' + descr1[:800] + '\n' + "Start Time: " +
             start1 + '\n' + "End Time: " + end1 + '\n' + "Venue: " +
             venue_string + '\n' + url1,
        media_url=logo1 if phone_number.startswith('+1') else None)

    return eventnames[0]
Пример #24
0
def get_events(user):
    social_user = user.social_auth.filter(provider='eventbrite')[0]
    eb = Eventbrite(social_user.access_token)
    events = eb.get('/users/me/events')
    return [event for event in events['events']]
Пример #25
0
from eventbrite import Eventbrite
from src import config

eventbrite = Eventbrite(config.api_key)
events = eventbrite.get(
    '/events/search?location.address=vancovuer&location.within=10km&expand=venue'
)
print(events)
Пример #26
0
def get_api_events(token):
    eventbrite = Eventbrite(token)
    return eventbrite.get('/users/me/events/?page_size=10')
Пример #27
0
def get_api_event_id(token, event_id):
    eventbrite = Eventbrite(token)
    return eventbrite.get('/events/{}'.format(event_id))
Пример #28
0
def get_api_attendee_checked(token, attendee_id, event_id):
    eventbrite = Eventbrite(token)
    url = '/events/{}/attendees/{}/'.format(event_id, attendee_id)
    return eventbrite.get(url)
Пример #29
0
def get_api_organization(token):
    """
    Get organization from the user of the token from the api
    """
    eventbrite = Eventbrite(token)
    return eventbrite.get('/users/me/organizations').get('organizations')
Пример #30
0
 def get_api_events(self, social_auth):
     access_token = social_auth.access_token
     eventbrite = Eventbrite(access_token)
     return eventbrite.get('/users/me/events/')['events']
Пример #31
0
        "start": event["start"]["utc"],
        "end": event["end"]["utc"],
        "duration": 100000,
        "topics": [],
        "entry": ["ticket"],
        "category": event["name"]["text"],
        "source": "eventbrite",
    }


def _post_payloads(payloads):
    responses = []
    for payload in payloads:
        r = requests.post(
            EVENTS_ENDPOINT,
            headers={"Content-type": "application/json"},
            data=json.dumps(payload),
        )
        print(r.status_code)
        responses.append(r)


if __name__ == "__main__":
    response = client.get(
        "/events/search/?q=technology&location.address=belfast&sort_by=-date")
    events = response["events"]

    transformed_events = [_transform_event(e) for e in events]

    _post_payloads(transformed_events)
Пример #32
0
def get_api_order(token, order_id):
    eventbrite = Eventbrite(token)
    url = '/orders/{}'.format(order_id)
    return eventbrite.get(url, expand=('merchandise', ))
Пример #33
0
        "entry": ["ticket"],
        "category": event["name"]["text"],
        "source": "eventbrite",
        "location": LOCATION.lower(),
    }


def _post_payloads(payloads):
    responses = []
    for payload in payloads:
        r = requests.post(
            EVENTS_ENDPOINT,
            headers={"Content-type": "application/json"},
            data=json.dumps(payload),
        )
        print(r.text)
        responses.append(r)


if __name__ == "__main__":
    init()

    response = client.get(
        f"/events/search/?q=technology&location.address={EVENTBRITE_LOCATION}&sort_by=-date"
    )
    events = response["events"]

    transformed_events = [_transform_event(e) for e in events]

    _post_payloads(transformed_events)
Пример #34
0
def get_api_order_barcode(token, org_id, barcode):
    eventbrite = Eventbrite(token)
    url = '/organizations/{}/orders/search?barcodes={}'.format(org_id, barcode)
    return eventbrite.get(url).get('orders')[0]