Пример #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 event(self):
        eventbrite = Eventbrite(eventtoken)
        event = eventbrite.get_event('user_event_id')
        print (event.pretty)
        print (event.url)
        print (event.start)

        return event

#autogenrate event model fields from api request




        def save(self, commit=True):
            event = super().save(commit=False)
            event_start = event.start
            event_url = event.url




        if commit:
            event.save()
        return page
Пример #3
0
 def search_events(self):
   preferences = self.user_preferences
   eventbrite = Eventbrite(self.api_token)
   events = eventbrite.event_search(**{
       'venue.city': preferences.venue_city,
       'price' : preferences.price, 
       'categories' : ",".join(preferences.category_id),
       'start_date.keyword': preferences.start_date_keyword
     })
   list_of_events = []
   for i in events["events"]:
     try:
       list_of_events += [{
         'event_name':i['name']['text'] if len(i['name']['text'])<50 else i['name']['text'][:50]+"...",
         'description':i['description'].get("text","")[:150]+"..." if i['description'].get("text","") != None else "",
         'start':datetime.strptime(i['start']['local'],"%Y-%m-%dT%H:%M:%S").strftime("%a, %d %b, %I:%M %p"),
         'end':datetime.strptime(i['end']['local'],"%Y-%m-%dT%H:%M:%S").strftime("%a, %d %b, %I:%M %p"),
         'url':i['url'],
         'logo':i['logo']['url']
       }]
     except TypeError:
       list_of_events += [{
         'event_name':i['name']['text'] if len(i['name']['text'])<50 else i['name']['text'][:50]+"...",
         'description':i['description'].get("text","")[:150]+"..." if i['description'].get("text","") != None else "",
         'start':datetime.strptime(i['start']['local'],"%Y-%m-%dT%H:%M:%S").strftime("%a, %d %b, %I:%M %p"),
         'end':datetime.strptime(i['end']['local'],"%Y-%m-%dT%H:%M:%S").strftime("%a, %d %b, %I:%M %p"),
         'url':i['url']
       }]
   return list_of_events
Пример #4
0
def get_eventbrite_events():
    """Get events from eventbrite."""
    eb = Eventbrite(config.EVENTBRITE_TOKEN)
    # me = eb.event_search(**{"user.id": eb.get_user()["id"]})
    # print(json.dumps(me))

    has_more = True
    events = []
    while has_more:
        search_results = eb.event_search(
            **{"location.address": "New+York", "location.within": "5mi"}
        )
        has_more = search_results.get("pagination", "").get(
            "has_more_items", False
        )
        for i in search_results.get("events", []):
            events.append(
                {
                    "id": i.get("id"),
                    "name": i.get("name").get("text"),
                    "description": i.get("description").get("text"),
                    "summary": i.get("summary"),
                    "start": i.get("start").get("local"),
                    "end": i.get("end").get("local"),
                    "status": i.get("status"),
                    "url": i.get("url"),
                }
            )

    return search_results["events"]
Пример #5
0
class Event:
    def __init__(self):
        self.eventbrite = Eventbrite(settings.EVENTBRITE_API_KEY)

    def get(self, events_id):
        """
        Given an eventbrite ID, returns the event object

        :param events_id:
        :return:
        """

        data = self.eventbrite.get_event(events_id)
        if data.status_code == 200:
            return data
        else:
            return None

    def get_multiple(self, category_ids, page_number):
        """
        Given a set of categories, returns relevant events
        :param category_ids:
        :param page_number:
        :return:
        """

        data = self.eventbrite.event_search(**{"page": page_number, "categories": category_ids})
        if data.status_code == 200:
            return data
        else:
            return None
Пример #6
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
Пример #7
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)
Пример #8
0
def get_events():
    eventbrite = Eventbrite(settings.EVENTBRITE_KEY)
    
    # Get my own User ID
    my_id = eventbrite.get_user()['id']
    
    # Get a raw list of events (includes pagination details)
    return eventbrite.event_search(**{'user.id': my_id})
Пример #9
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']
Пример #10
0
def subcategories():
    eventbrite = Eventbrite(token)
    subcategory_list = eventbrite.get_subcategories()
    subcategory_name = [
        subcategory['name']
        for subcategory in subcategory_list['subcategories']
    ]
    return render_template('subcategories.html',
                           subcategory_name=subcategory_name)
Пример #11
0
    def __init__(self, oauth_token, environment="qa"):

        if environment not in API_URLS.keys():
            raise ValueError("environment must be in: {}".format(
                API_URLS.keys()))

        Eb.__init__(self,
                    oauth_token,
                    eventbrite_api_url=API_URLS[environment])
Пример #12
0
def suggestEvents(flightJson, testDate=None):
    eventbrite = Eventbrite('JPFW2R7QDBH4J62PPDO2')

    flight = flightJson
    arrival_airport = flight["segmentReferences"]["arrivalAirport"]
    #print ("arrival airport", arrival_airport)

    if testDate is None:
        date = flight["segmentReferences"]['arrivalDate']
        time = flight["segmentReferences"]['arrivalTime']
        arrival_time = date[:-1] + 'T' + time + ":00"
    else:
        time = flight["segmentReferences"]['arrivalTime']
        arrival_time = testDate[:-1] + 'T' + time + ":00"

    #print (arrival_time)

    end_date = arrival_time[:8] + str(int(arrival_time[8:10]) +
                                      3) + arrival_time[10:]

    #print (end_date)

    airports = pd.read_csv(
        'https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat',
        header=None)
    latitude = airports[airports[4] == arrival_airport][6]
    longitude = airports[airports[4] == arrival_airport][7]

    events = eventbrite.event_search(
        **{
            'sort_by': 'best',
            'location.latitude': latitude,
            'location.longitude': longitude,
            "location.within": "70km",
            "start_date.range_start": arrival_time,
            "start_date.range_end": end_date,
            'high_affinity_categories': 'business'
        })
    #return events

    response = {}

    if type(events) is str:
        return None
    else:
        if len(events['events']) < 3:
            response.append(events['events']['name']['text'])
        else:

            #print ('ffdsfdsf')
            for event_name in events['events'][:3]:

                response[event_name['name']['text']] = event_name['url']
                #response.append(event_name['url'])

        return response
Пример #13
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')
Пример #14
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")
Пример #15
0
def setup_connection():
	eb = Eventbrite(mykey)
	#if recordKeys == True: keysToUse.write(str('eb = ',str(eb) ))
	user = eb.get_user()
	#if recordKeys == True: keysToUse.write(str('user = '******'Here is the user id ', user['id'])
		return eb
	except KeyError:
		print('This will not go well')
		exit()
Пример #16
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
Пример #17
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
Пример #18
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
Пример #19
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)
Пример #20
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': []}
Пример #21
0
class TestEvents(unittest.TestCase):

    def setUp(self):
        self.eventbrite = Eventbrite(OAUTH_TOKEN)

    @unittest.skipIf(condition=skip_user_id_tests, reason='Needs a USER_ID')
    @unittest.skipIf(
        condition=skip_integration_tests,
        reason='Needs an OAUTH_TOKEN')
    def test_post_event(self):

        event_name = 'client_test_{0}'.format(datetime.now())

        event_data = {
            'event.name': {
                'html': event_name,
            },
            'event.start': {
                'utc': '2015-03-07T20:00:00Z',
                'timezone': 'America/Los_Angeles',
            },
            'event.end': {
                'utc': '2015-03-07T23:00:00Z',
                'timezone': 'America/Los_Angeles',
            },
            'event.currency': 'USD',
            'event.online_event': True,
            'event.listed': False,
            'event.category_id': '110',
            'event.format_id': '5',
            'event.password': "******",
            'event.capacity': 10,
        }
        event = self.eventbrite.post('/events/', data=event_data)
        self.assertEqual(event_name, event['name']['text'])
        self.assertEqual(event_name, event['name']['html'])
        # Just for access to see the event, not full authentication
        self.assertEqual(event['password'], "test")

    @unittest.skipIf(condition=skip_user_id_tests, reason='Needs a USER_ID')
    @unittest.skipIf(
        condition=skip_integration_tests, reason='Needs an OAUTH_TOKEN')
    def test_search_events(self):
        data = {
            'location.latitude': '40.4313684',
            'start_date.keyword': 'today',
            'location.longitude': '-79.9805005',
            'location.within': '10km'
        }
        events = self.eventbrite.event_search(**data)
        self.assertLess(events['pagination'][u'object_count'], 1000)
    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
Пример #23
0
class TestEvents(unittest.TestCase):
    def setUp(self):
        self.eventbrite = Eventbrite(OAUTH_TOKEN)

    @unittest.skipIf(condition=skip_user_id_tests, reason='Needs a USER_ID')
    @unittest.skipIf(condition=skip_integration_tests,
                     reason='Needs an OAUTH_TOKEN')
    def test_post_event(self):

        event_name = 'client_test_{0}'.format(datetime.now())

        event_data = {
            'event.name': {
                'html': event_name,
            },
            'event.start': {
                'utc': '2015-03-07T20:00:00Z',
                'timezone': 'America/Los_Angeles',
            },
            'event.end': {
                'utc': '2015-03-07T23:00:00Z',
                'timezone': 'America/Los_Angeles',
            },
            'event.currency': 'USD',
            'event.online_event': True,
            'event.listed': False,
            'event.category_id': '110',
            'event.format_id': '5',
            'event.password': "******",
            'event.capacity': 10,
        }
        event = self.eventbrite.post('/events/', data=event_data)
        self.assertEqual(event_name, event['name']['text'])
        self.assertEqual(event_name, event['name']['html'])
        # Just for access to see the event, not full authentication
        self.assertEqual(event['password'], "test")

    @unittest.skipIf(condition=skip_user_id_tests, reason='Needs a USER_ID')
    @unittest.skipIf(condition=skip_integration_tests,
                     reason='Needs an OAUTH_TOKEN')
    def test_search_events(self):
        data = {
            'location.latitude': '40.4313684',
            'start_date.keyword': 'today',
            'location.longitude': '-79.9805005',
            'location.within': '10km'
        }
        events = self.eventbrite.event_search(**data)
        self.assertLess(events['pagination'][u'object_count'], 1000)
Пример #24
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
Пример #25
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
Пример #26
0
 def get_subcategories(self):
   # Get full list of subcategories
   eventbrite = Eventbrite(self.api_token)
   categories = []
   # Paginate 4 pages of responses
   for x in range(4):
     subcategories = eventbrite.get_subcategories(**{'page': str(x+1)})
     for i in subcategories["subcategories"]:
       categories += [{
         "sub_name":i["name"],
         "sub_id":i["id"],
         "parent_name":i["parent_category"]["short_name"],
         "parent_id":i["parent_category"]["id"]
       }]
   return categories
def token_swap(old_oauth_token):
    print("swapping token")
    old_index = tokens.index(old_oauth_token)
    new_index = (old_index + 1) if (old_index + 1 < len(tokens)) else 0
    oauth_token = tokens[new_index]
    eventbrite = Eventbrite(oauth_token)
    return [oauth_token, eventbrite]
Пример #28
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)
Пример #29
0
def check_eventbrite_registration(email):
    eventbrite = Eventbrite(settings.EVENTBRITE_API_PRIVATE_TOKEN)
    event_id = Event.objects.all()[0].eventbrite_event_id

    attendees = eventbrite.get_event_attendees(event_id=event_id, page=1)
    number_of_pages = (int(attendees.pagination['page_count']))

    attendee_emails = []
    for page in range(1, number_of_pages + 1):
        attendees = eventbrite.get_event_attendees(event_id=event_id,
                                                   page=page)

        for attendee in attendees['attendees']:
            attendee_emails.append(attendee['profile']['email'].lower())

    return email.lower() in attendee_emails
Пример #30
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
Пример #31
0
class EventBriteTests(TestCase):
    def setUp(self):
        env = environ.Env()
        env_file = os.path.join(os.getcwd(), ".env")
        environ.Env.read_env(env_file)

        self.eventbrite = Eventbrite(env('EVENTBRITE_KEY'))

    def test_connection_to_eventbrite(self):
        """
        Test whether connection to EventBrite is successful.
        """
        self.assertEqual(
            self.eventbrite.headers['content-type'], 'application/json'
        )

    def test_eventbrite_user(self):
        """
        Test the correct user is returned when using the EventBrite api.
        """
        user = self.eventbrite.get_user()

        self.assertEqual(user.headers['Content-Type'], 'application/json')
        self.assertEqual(user['name'], 'Ollie Gardner')

    def test_eventbrite_organiser(self):
        """
        Test getting SoCS EventBrite page from organiser ID.
        """
        organiser = self.eventbrite.get_organizers(6830828415)

        self.assertEqual(organiser.headers['Content-Type'], 'application/json')
        self.assertEqual(
            organiser['name'],
            'School of Computing Science, University of Glasgow'
        )

    def test_eventbrite_organiser_events(self):
        """
        Test getting SoCS EventBrite events from organiser ID.
        """
        organiser_events = self.eventbrite.get_organizer_events(6830828415)

        self.assertEqual(
            organiser_events.headers['Content-Type'], 'application/json'
        )
        self.assertGreater(len(organiser_events), 1)
def get_entities(datatype):
    since = request.args.get('since')
    auth = request.authorization
    password = auth.password
    eventbrite = Eventbrite(password)
    entities = sorted(data_access_layer.get_entities(since, datatype, eventbrite), key=lambda k: k["_updated"])

    return Response(json.dumps(entities), mimetype='application/json')
Пример #33
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")
Пример #34
0
class TestClientAccessMethods(unittest.TestCase):

    def setUp(self):
        self.eventbrite = Eventbrite(OAUTH_TOKEN)

    @unittest.skipIf(condition=skip_integration_tests, reason='Needs an OAUTH_TOKEN')
    def test_get_user_me(self):
        evbobject = self.eventbrite.get_user()

        # Did we get an EventbriteObject?
        self.assertTrue(isinstance(evbobject, EventbriteObject))

        # check attributes
        for attribute in ['id', 'pk', 'type', 'is_paginated', 'is_list', 'status_code']:
            self.assertTrue(attribute in evbobject.__dict__.keys())

        # check that an ID exists
        self.assertTrue(evbobject.get('id'))

    @unittest.skipIf(condition=skip_user_id_tests, reason='Needs a USER_ID')
    @unittest.skipIf(condition=skip_integration_tests, reason='Needs an OAUTH_TOKEN')
    def test_get_user(self):
        evbobject = self.eventbrite.get_user(USER_ID)

        # Did we get an EventbriteObject?
        self.assertTrue(isinstance(evbobject, EventbriteObject))

        # check attributes
        for attribute in ['id', 'pk', 'type', 'is_paginated', 'is_list', 'status_code']:
            self.assertTrue(attribute in evbobject.__dict__.keys())

        # check that the ID's match
        self.assertEqual(evbobject.get('id'), USER_ID)

    @unittest.skipIf(condition=skip_integration_tests, reason='Needs an OAUTH_TOKEN')
    def test_webhook_no_internet(self):
        webhook = {
            "api_url": EVENTBRITE_API_URL + 'users/me/',
            "config": {
                "endpoint_url": "https://myawesomeapp.com/webhook",
                "insecure_ssl": "0"
            }
        }
        evbobject = self.eventbrite.webhook_to_object(webhook)
        self.assertTrue('id' in evbobject)
Пример #35
0
def show_events_view(request):
    eventbrite = Eventbrite(eventtoken)
    my_id = eventbrite.get_user()['id']
    events = eventbrite.event_search(**{'user.id': my_id})
    existing_events = Event.objects.all().values("event_id")
    events_list = []
    for i in existing_events:
        events_list.append(i['event_id'])

    for x in events['events']:
        event_id = (x['id'])

        if event_id in events_list:
            pass
        else:
            start_time = parse_datetime(x['start']['local'])
            api_url = (x['url'])
            event_id = (x['id'])
            event_url = (x['url'])
            title = (x['name']['html'])
            name_code = title[4:7].lower()
            if name_code == "cor":
                code = "core"
            elif name_code == "int":
                code = "inter"
            elif name_code == "hig":
                code = "higher"

            else:
                code = "other"
            print(event_id)

            print(start_time)
            new_event = Event(api_url=api_url,
                              event_start=start_time,
                              title=title,
                              event_url=api_url,
                              event_code=code,
                              event_id=event_id)
            print(new_event)
            new_event.save()

    context = {}

    return render(request, 'showevents.html', context)
Пример #36
0
    def test_api_get(self):
        eventbrite = Eventbrite(OAUTH_TOKEN)

        payload = eventbrite.api("get", "/users/me/", {})

        self.assertEqual(
            sorted([u'id', u'first_name', u'last_name', u'emails', u'name']),
            sorted(payload.keys())
        )

        self.assertEqual(
            payload.resource_uri,
            EVENTBRITE_API_URL + 'users/me/'
        )

        self.assertTrue(payload.ok)
        self.assertTrue(isinstance(payload.elapsed, timedelta))
        self.assertTrue(isinstance(payload.headers, CaseInsensitiveDict))
Пример #37
0
class Mesevent(object):
    eventbrite = Eventbrite('NL3IVYPNAYASG6QYJSMF')
    user_id = eventbrite.get_user()['id']
    print("user is::::")
    print("%s", user_id)
    events = eventbrite.event_search(**{'user.id': user_id})
    print("%s", events)

    @app.route("/https://www.eventbrite.com/")
    def go_to_external_url():
        print("redirecting to eventbrite...")

    def __init__(self, city, _id=None):
        self.city = venue
        self._id = uuid.uuid4().hex if _id is None else _id
        self.go_to_external_url

    def __repr__(self):
        return "<Your events in city: {}>".format(self.city)

    def save_to_mongo(self):
        Database.update(FC.COLLECTION, {"_id": self._id}, self.json())

    def json(self):
        return {
            "city": self.city,
            "_id": self._id,
        }

    @classmethod
    def get_by_id(cls, item_id):
        return cls(**Database.find_one(FC.COLLECTION, {"_id": item_id}))

    @classmethod
    def get_by_event_id(cls, city):
        return [
            cls(**elem)
            for elem in Database.find(FC.COLLECTION, {"city": city})
        ]

    # def get_vacant_events(self):
    # 	return (self.total_events - self.events_booked)

    def get_price(self):
        return self.price

    def delete(self):
        Database.remove(FC.COLLECTION, {"_id": self._id})

    @classmethod
    def all(cls):
        return [cls(**elem) for elem in Database.find(FC.COLLECTION, {})]

    @staticmethod
    def is_event_full():
        raise UserErrors.FlightFull("Sorry! All the events are currently full")
Пример #38
0
class Category:
    def __init__(self):
        self.eventbrite = Eventbrite(settings.EVENTBRITE_API_KEY)

    def all(self):
        """
        This returns all categories from the eventbrite API

        :return:
        :return: List of categories
        """
        eventbrite_categories = self.eventbrite.get_categories()
        if eventbrite_categories.status_code == 200:
            return eventbrite_categories["categories"]
        else:
            return None

    def get(self, category_id):
        """
        Given the id of a category, returns that eventbrite category object

        :param category_id:
        :return:
        """
        data = self.eventbrite.get_category(category_id)
        if data.status_code == 200:
            return data
        else:
            return None

    def get_multiple(self, category_ids):
        """
        Returns category objects for category ids given

        :param category_ids:
        :return:
        """
        categories = []
        for category_id in category_ids:
            categories.append(self.get(category_id))

        return categories
Пример #39
0
    def handle(self, *args, **options):
        "Pull events from Eventbrite and store them in the db as Event instances"
        # https://github.com/eventbrite/eventbrite-sdk-python/blob/master/eventbrite/client.py
        eventbrite = Eventbrite(settings.EVENTBRITE_OAUTH_TOKEN
                                or options.get('token'))
        number_of_events_to_parse = options['number_of_events']
        count = 0
        page = 1
        events = eventbrite.event_search(
            expand='ticket_availability,organizer', page=page)

        while count < number_of_events_to_parse:
            for event in events.get('events'):
                cost = int(
                    (float(event['ticket_availability']['minimum_ticket_price']['major_value']) \
                    + float(event['ticket_availability']['maximum_ticket_price']['major_value'])
                    )/2
                )
                try:
                    # only unique events with values for all fields will be saved
                    Event.objects.create(
                        name=event['name']['text'],
                        organization=event['organizer']['name'],
                        event_original_id=event['id'],
                        start_date=parser.parse(event['start']['local']),
                        cost=cost)
                    count += 1
                except:
                    pass

                if count >= number_of_events_to_parse:
                    break

            if events.get('pagination').get(
                    'has_more_items') and count < number_of_events_to_parse:
                page += 1
                events = eventbrite.event_search(
                    expand='ticket_availability,organizer', page=page)
            else:
                break

        print("\nSaved {} events in the database!\n".format(count))
Пример #40
0
def set_tickets(service: Eventbrite, event_id: int, capacity: int):
    r = service.post(
        path=
        f"https://www.eventbriteapi.com/v3/events/{event_id}/ticket_classes/",
        data={
            "ticket_class": {
                "name": "VIP",
                "quantity_total": capacity,
                "free": True
            }
        })
Пример #41
0
    def test_api_get(self):
        eventbrite = Eventbrite(OAUTH_TOKEN)

        payload = eventbrite.api("get", "/users/me/", {})

        self.assertEqual(
            sorted([u'id', u'first_name', u'last_name', u'emails', u'name']),
            sorted(payload.keys())
        )

        self.assertEqual(
            payload.resource_uri,
            EVENTBRITE_API_URL + 'users/me/'
        )

        self.assertTrue(payload.ok)
        self.assertTrue(isinstance(payload.elapsed, timedelta))
        self.assertTrue(isinstance(payload.headers, CaseInsensitiveDict))

        self.assertFalse(
            'content-type' in payload.request.headers
        )
    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
Пример #43
0
def get_event_results(q, datestring):

    datestring = datetime.strptime(datestring, "%m/%d/%Y")
    datestring = datetime.strftime(datestring, "%Y-%m-%d")
    client = Eventbrite(auth_key)

    
    start_date = datestring+"T01:00:00"
    end_date = datestring+"T23:55:00"
    popular = True
    sort_by = "best"
    categories ="103,110"
    # expand = "https://www.eventbriteapi.com/v3/events/search/?location.address=Indore&expand=organizer,venue&token=JXPOFPSSCU4OQGRAG5RH"
    params = {"q": q, "start_date.range_start": start_date, 
              "start_date.range_end": end_date, "sort_by": sort_by, "popular": popular, "categories": categories, 'expand': 'venue'}
    search_response = client.event_search(**params)
    events = search_response.get('events', [])
    rendered_responses = []
    
    for event in events:
        if event.get('logo'):
            image_url = event['logo']['url']
        else:
            image_url = None
        rendered_responses.append({'name': event['name']['html'],
                                    'start': datetime.strptime(event['start']['local'], ('%Y-%m-%dT%H:%M:%S')),
                                    'status': event['status'],
                                    'url': event['url'], 
                                    'locale': event['locale'],
                                    'id': event['id'],
                                    'description': event['description']['text'],
                                    'image':image_url,
                                    'venue': event['venue']['address'],
                                    'latitude': event['venue']['latitude'],
                                    'longitude': event['venue']['longitude']})

    pprint.pprint(rendered_responses)
    return rendered_responses
Пример #44
0
class TestCRUDWebhooks(unittest.TestCase):

    def setUp(self):
        self.eventbrite = Eventbrite(OAUTH_TOKEN)

    @unittest.skipIf(
        condition=skip_integration_tests,
        reason='Needs an OAUTH_TOKEN')
    def test_basic_webhook(self):
        data = dict(
            endpoint_url='http://example.com',
            actions='',
            event_id='15562735561'
        )
        response = self.eventbrite.post_webhooks(**data)
        self.assertTrue(response.ok)
        self.assertEqual(response['event_id'], '15562735561')
Пример #45
0
 def setUp(self):
     self.eventbrite = Eventbrite(OAUTH_TOKEN)
Пример #46
0
class TestClientAccessMethods(unittest.TestCase):

    def setUp(self):
        self.eventbrite = Eventbrite(OAUTH_TOKEN)

    @unittest.skipIf(
        condition=skip_integration_tests,
        reason='Needs an OAUTH_TOKEN')
    def test_get_user_me(self):
        evbobject = self.eventbrite.get_user()

        # Did we get an EventbriteObject?
        self.assertTrue(isinstance(evbobject, EventbriteObject))

        # check attributes
        attrs = ['id', 'pk', 'type', 'is_paginated', 'is_list', 'status_code']
        for attribute in attrs:
            self.assertTrue(attribute in evbobject.__dict__.keys())

        # check that an ID exists
        self.assertTrue(evbobject.get('id'))

    @unittest.skipIf(
        condition=skip_user_id_tests, reason='Needs a USER_ID')
    @unittest.skipIf(
        condition=skip_integration_tests, reason='Needs an OAUTH_TOKEN')
    def test_get_user(self):
        evbobject = self.eventbrite.get_user(USER_ID)

        # Did we get an EventbriteObject?
        self.assertTrue(isinstance(evbobject, EventbriteObject))

        # check attributes
        attrs = ['id', 'pk', 'type', 'is_paginated', 'is_list', 'status_code']
        for attribute in attrs:
            self.assertTrue(attribute in evbobject.__dict__.keys())

        # check that the ID's match
        self.assertEqual(evbobject.get('id'), USER_ID)

    @unittest.skipIf(
        condition=skip_integration_tests, reason='Needs an OAUTH_TOKEN')
    def test_webhook_no_internet(self):
        webhook = {
            "api_url": EVENTBRITE_API_URL + 'users/me/',
            "config": {
                "endpoint_url": "https://myawesomeapp.com/webhook",
                "insecure_ssl": "0"
            }
        }
        evbobject = self.eventbrite.webhook_to_object(webhook)
        self.assertTrue('id' in evbobject)

    @unittest.skipIf(
        condition=skip_user_id_tests, reason='Needs a USER_ID')
    @unittest.skipIf(
        condition=skip_integration_tests, reason='Needs an OAUTH_TOKEN')
    def test_get_event_expansions(self):
        # Get event with no expansions
        evbobject = self.eventbrite.get_event('11260994939')
        self.assertFalse('ticket_classes' in evbobject)

        # Now get event with ticket_classes expansion
        evbobject = self.eventbrite.get_event(
            '11260994939', expand='ticket_classes')
        self.assertTrue('ticket_classes' in evbobject)
Пример #47
0
import os
import requests
from eventbrite import Eventbrite


API_URL = 'https://www.eventbriteapi.com/v3/'
ACCESS_TOKEN = os.environ['EVENTBRITE_OAUTH_TOKEN']

eb = Eventbrite(ACCESS_TOKEN)

ATTENDEE_HEADERS = [
    'profile.name',
    'profile.email',
    'status',
    'costs.gross.major_value',
    'event_id',
]

EVENT_HEADERS = [
    'name.text',
    'id',
    'start.local',
]

USER = eb.get_user()
USER_ID = USER['id']

def flatten(d):
    # test: build_dotted_keys({'a': {'b': 2, 'c': {'d': 4}, 'e':[{'f':1231, 'g':{'h':0}}, {'z':34223}]}})
    # test: build_dotted_keys({'a': {'b': 2, 'c': {'d': 4}, 'e':[{'f':1231}]}})
    ret = {}
Пример #48
0
class TestEvents(unittest.TestCase):

    def setUp(self):
        self.eventbrite = Eventbrite(OAUTH_TOKEN)

    @unittest.skipIf(condition=skip_user_id_tests, reason='Needs a USER_ID')
    @unittest.skipIf(
        condition=skip_integration_tests,
        reason='Needs an OAUTH_TOKEN')
    def test_post_event(self):
        event_name = 'client_test_{0}'.format(datetime.now())
        event_data = self._get_event_data(event_name)
        event = self.eventbrite.post_event(event_data)
        self.assertEqual(event_name, event['name']['text'])
        self.assertEqual(event_name, event['name']['html'])
        # Just for access to see the event, not full authentication
        self.assertEqual(event['password'], "test")

    @unittest.skipIf(condition=skip_user_id_tests, reason='Needs a USER_ID')
    @unittest.skipIf(
        condition=skip_integration_tests, reason='Needs an OAUTH_TOKEN')
    def test_search_events(self):
        data = {
            'location.latitude': '40.4313684',
            'start_date.keyword': 'today',
            'location.longitude': '-79.9805005',
            'location.within': '10km'
        }
        events = self.eventbrite.event_search(**data)
        self.assertLess(events['pagination'][u'object_count'], 1000)

    @unittest.skipIf(
        condition=skip_integration_tests, reason='Needs an OAUTH_TOKEN')
    def test_publish_unpublish_event(self):

        """ First, creat a draft event """
        event_data = self._get_event_data()
        event = self.eventbrite.post_event(event_data)
        self.assertTrue(event.ok,
                        msg=event.get('error_description', None))

        """ Next, create a ticket class for the event, because an event
            can't be published without one """
        ticket_data = self._get_ticket_data()
        response = self.eventbrite.post_event_ticket_class(event['id'],
                                                           data=ticket_data)

        """Finally, try to publish the event"""
        response = self.eventbrite.publish_event(event['id'])
        self.assertTrue(response.ok,
                        msg=response.get('error_description', None))

        """Now try to unpublish the event"""
        response = self.eventbrite.unpublish_event(event['id'])
        self.assertTrue(response.ok,
                        msg=response.get('error_description', None))

    @unittest.skipIf(
        condition=skip_integration_tests, reason='Needs an OAUTH_TOKEN')
    def test_create_ticket_class(self):

        event_data = self._get_event_data()
        event = self.eventbrite.post_event(event_data)

        ticket_data = self._get_ticket_data()
        response = self.eventbrite.post_event_ticket_class(event['id'],
                                                           data=ticket_data)
        self.assertTrue(response.ok,
                        msg=response.get('error_description', None))

    def _get_ticket_data(self):

        return {
            'ticket_class.name': 'client_test_ticket_{0}'.format(datetime.now()),
            'ticket_class.description': 'Python API Client testing',
            'ticket_class.quantity_total': 100,
            'ticket_class.cost': 'USD,4500'
        }

    def _get_event_data(self, event_name='client_test_{0}'.format(datetime.now())):
        """ Returns a dictionary representing a valid event """

        # if not event_name:
        #     event_name = 'client_test_{0}'.format(datetime.now())

        return {
            'event.name': {
                'html': event_name,
            },
            'event.start': {
                'utc': (datetime.now() + timedelta(days=1)).strftime(EB_ISO_FORMAT),
                'timezone': 'America/Los_Angeles',
            },
            'event.end': {
                'utc': (datetime.now() + timedelta(days=1,hours=1)).strftime(EB_ISO_FORMAT),
                'timezone': 'America/Los_Angeles',
            },
            'event.currency': 'USD',
            'event.online_event': True,
            'event.listed': False,
            'event.category_id': '110',
            'event.format_id': '5',
            'event.password': "******",
            'event.capacity': 10,
        }
Пример #49
0
def ticketing(request, id):
    """The post id is main article describing weekend. Looks up all event objects linked
    to the post. For each object, uses Eventbrite API to create an event page on Eventbrite,
    and creates all the usual tickets. Returns event id and adds it to event object.
    Makes all the Eventbrite events live, and publishes the main post and all event posts."""
    mainpost = Post.objects.get(id = id)
    events = Event.objects.filter(rpost = id)
    if request.method == 'POST': #We're going for it
        if request.POST.get('delay') == 'yes':
            delay = True
        else:
            delay = False
        from eventbrite import Eventbrite
        eventbrite = Eventbrite(settings.TOKEN)
        capacity = 38
        eventzone = "America/New_York"
        t1 = {'ticket_class.name': 'Children (under 12)', 'ticket_class.cost': 'USD,300', 'ticket_class.quantity_total': capacity} 
        t2 = {'ticket_class.name': 'Member', 'ticket_class.cost': 'USD,500', 'ticket_class.quantity_total': capacity} 
        t3 = {'ticket_class.name': 'Adult', 'ticket_class.cost': 'USD,500', 'ticket_class.quantity_total': capacity} 
        t4 = {'ticket_class.name': 'Senior (60+)', 'ticket_class.cost': 'USD,300', 'ticket_class.quantity_total': capacity} 
        t5 = {'ticket_class.name': 'Support new programs for the Planetarium!', 'ticket_class.donation': True} 
        t1free = {'ticket_class.name': 'Children (under 12)', 'ticket_class.free': True, 'ticket_class.quantity_total': capacity} 
        t2free = {'ticket_class.name': 'Member', 'ticket_class.free': True, 'ticket_class.quantity_total': capacity} 
        t3free = {'ticket_class.name': 'Adult', 'ticket_class.free': True, 'ticket_class.quantity_total': capacity} 
        t4free = {'ticket_class.name': 'Senior (60+)', 'ticket_class.free': True, 'ticket_class.quantity_total': capacity} 
        t5free = {'ticket_class.name': 'Support new programs for the Planetarium!', 'ticket_class.donation': True} 
        tickets = [t1, t2, t3, t4, t5]
        freetickets = [t1free, t2free, t3free, t4free, t5free]
        evresponse = {}
        tkresponse = []
        for e in events:
            if e.ebcode is None or len(e.ebcode) < 3:
                eventname = e.title
                pics = Illustration.objects.filter(event=e.id)
                if len(pics) > 0:
                   content = picparse(e.content, pics)
                else:
                   content = e.content
                eventdescription = content
                eventstart = loctime2ev(e.on)
                if e.end:
                    eventend = loctime2ev(e.end)
                else:
                    eventend = loctime2ev(e.on + timedelta(minutes = 60))
                #make a new event
                event = eventbrite.post_event({'event.name.html':eventname, 'event.description.html':eventdescription,
                                             'event.start.utc':eventstart, 'event.end.utc':eventend,
                                             'event.start.timezone':eventzone, 'event.end.timezone':eventzone,
                                             'event.currency': 'USD', 'event.capacity': capacity})
                evresponse['event'] = event
                #make tickets
                if e.free:
                    ticketlist = freetickets
                else:
                    ticketlist = tickets
                for ticket in ticketlist:
                    tkresponse.append(eventbrite.post_event_ticket_class(event.get('id'), ticket))
                evresponse['tickets'] = tkresponse
                e.ebcode = event.get('id') #For the ticketing box on our website
            if not delay and e.publish == False:
                e.publish = True
                e.save()
            #eventbrite.publish_event(event.get('id')) #make live on Eventbrite - does not work, API incomplete.
        if not delay and mainpost.publish == False:
            mainpost.publish = True
            mainpost.save()
    else: # Last chance to bail.
        pass        
    return render(request, 'ticketing.html', locals())
Пример #50
0
from django.shortcuts import render
from django.views.generic import CreateView, TemplateView, ListView
from .models import *
from eventbrite import Eventbrite


eventbrite = Eventbrite('SRBFZK5OYQYP3CZDHN22')
print(eventbrite)
user = eventbrite.get_user()

print(user)


# Create your views here.
class Eventos(TemplateView):
    model =  EventosModel
    template_name = 'eventos/list.html'
# Playing with Eventbrite 
# From https://www.eventbrite.com/developer/v3/quickstart/ and 
# https://pypi.python.org/pypi/eventbrite/3.2.0
# https://github.com/eventbrite/eventbrite-sdk-python
# https://www.eventbrite.com/developer/v3/endpoints/users/ == formate of eb.get('users/me/...')
# Developer: Ginny C Ghezzo 
# Not sure the difference of ventbrite.get user2 = eb.get('/users/me')
# What I learned: 

import requests 
from eventbrite import Eventbrite
import sys 

if len(sys.argv) > 1:
	mykey = sys.argv[1]
else: 
	mykey = input('Shhh... what is your private key: ')
#response = requests.get()
eb = Eventbrite(mykey)
user = eb.get_user()				# why not use eventbrite.get user2 = eb.get('/users/me')
print('**User Information**')
for q in user:
	print(q, ' = ', user[q])
# I have no idea how to get the ids from the user 
print(eb.__dir__())
Пример #52
0
 def __init__(self):
     self.eventbrite = Eventbrite(settings.EVENTBRITE_API_KEY)