Exemple #1
0
def find_events(artist):
    #print("Search for " + artist)

    EVENTFUL_KEY = app.config['EVENTFUL_KEY']
    api = eventful.API('EVENTFUL_KEY')

    performers = api.call('/performers/search', keywords=artist)

    if int(float(performers['page_count'])) == 0:
        print("No artist found")
        return []

    dict_or_list = performers['performers']['performer']

    # Get performer info. Must check if it is a list or a dict because sometimes there are multiple
    # performers going by same or similar names
    if type(dict_or_list) is dict:
        performer_id = performers['performers']['performer']['id']
        event_count = performers['performers']['performer']['event_count']
    else:
        performer_id = performers['performers']['performer'][0]['id']
        event_count = performers['performers']['performer'][0]['event_count']

    # Don't bother if the artist has no events :^)
    event_count = int(float(event_count))
    if event_count == 0:
        return []
    else:
        return api.call('/performers/events/list', id=performer_id)['event']
Exemple #2
0
def get_events():
    """
    Docs: https://api.eventful.com/docs/events/search
    Need to sort by date and then show some actual details
    """
    api = eventful.API(settings.EVENTFUL_API_KEY)
    return api.call('/events/search', l='Dover, NH').get('events').get('event')
    def do(self):

        cityname = City.objects.all()
        #print cityname
        for city in cityname:
            print city.city_name
            location = city.city_name
            if (location != "None"):

                api = eventful.API('mm576kLMq5X9DRgt')
                # api.login('username', 'password')
                events = api.call('/events/search', l=location)
                events = api.call('/events/search',
                                  l=location,
                                  page_size=(events['total_items']))
                #print events
                for e in events['events']['event']:
                    (event,
                     created) = Event.objects.get_or_create(eventid=e['id'])
                    if not created: continue

                    print 'Processing event: "%s"' % e['title']

                    event.eventid = e['id']
                    event.title = e['title']
                    if e.get('description'):
                        event.description = self.remove_html_markup(
                            e['description'])
                    else:
                        event.description = 'None'
                    event.organizer = e['owner']
                    if e.get('venue_address'):
                        event.venue = e['venue_address']
                    else:
                        event.venue = 'None'

                    event.category = 'None'

                    if e.get('image') and e['image'].get('url'):
                        event.image = e['image']['url']
                    else:
                        event.image = 'None'

                    if e.get('latitude'):
                        event.latitude = e['latitude']
                    else:
                        event.latitude = 'None'
                    event.longitude = e['longitude']
                    event.city = e['city_name']
                    event.api_vendor = 'Eventful'
                    event.event_url = e['url']

                    datetime = e['start_time'].split(' ')
                    event.event_date = datetime[0]
                    event.event_time = datetime[1]

                    event.save()
def get_events(query, location):

    id = []
    url = []
    title = []
    start_time = []
    stop_time = []
    venue_id = []
    venue_name = []
    city_name = []
    region_name = []
    country_name = []
    latitude = []
    longitude = []
    geocode_type = []
    api = eventful.API(EVENTFUL_API_KEY, 'api.eventful.com')
    event = api.call('/events/search', q=query, l=location)
    print(event)
    for e in event['events']['event']:
        id.append(e['id'])
        url.append(e['url'])
        title.append(e['title'])
        start_time.append(e['start_time'])
        stop_time.append(e['stop_time'])
        venue_id.append(e['venue_id'])
        venue_name.append(e['venue_name'])
        city_name.append(e['city_name'])
        region_name.append(e['region_name'])
        country_name.append(e['country_name'])
        latitude.append(e['latitude'])
        longitude.append(e['longitude'])
        geocode_type.append(e['geocode_type'])
        #print ("%s at %s" % (event['title'], event['venue_name']))
        #print ("%s" % (e['country_name']))
    event_dict = {
        'id': id,
        'url': url,
        'title': title,
        'start_time': start_time,
        'stop_time': stop_time,
        'venue_id': venue_id,
        'venue_name': venue_name,
        'city_name': city_name,
        'region_name': region_name,
        'country_name': country_name,
        'latitude': latitude,
        'longitude': longitude,
        'geocode_type': geocode_type
    }

    get_event_list_output(event_dict)
Exemple #5
0
import eventful
import pymongo
import datetime

client = pymongo.MongoClient("localhost", 27017)
db = client.west

collection = db.eventfulevents

api = eventful.API('LXjPQvppHPrvFstn')

# If you need to log in:
# api.login('username', 'password')
counter = 0

events = api.call('/events/search', q='music', l='San Francisco')
for event in events['events']['event']:
    print "%s" % (event['city_name'])
    collection.insert_one({
        "event": event,
        "date": datetime.datetime.now(),
        "title": event['title']
    })
    counter += 1
    print counter
    print "---------------------------------------------\n"
"""
{'olson_path': 'America/New_York', 'recur_string': None, 'image': None, 'modified': '2017-12-26 22:50:32', 'postal_code': '30643', 'owner': 'evdb', 'geocode_type': 'EVDB Geocoder', 'id': 'E0-001-108637459-0', 'link_count': None, 'region_name': 'Georgia', 'country_abbr': 'USA', 'going_count': None, 'venue_id': 'V0-001-003984905-5', 'region_abbr': 'GA', 'privacy': '1', 'venue_address': 'Depot Street', 'venue_display': '1', 'created': '2017-11-13 01:52:17', 'tz_country': None, 'comment_count': None, 'going': None, 'stop_time': None, 'venue_name': 'High Cotton Music Hall', 'country_name': 'United States', 'watching_count': None, 'country_abbr2': 'US', 'description': u' $20 in advance, $25 at the door www.randallbramblett.com Randall Bramblett may be known for writing for and playing on stage with rock\u2019s legends like Bonnie Raitt, The Allman Brothers Band, Steve Winwood and Widespread Panic, but it\u2019s Bramblett\u2019s own career as frontman where his artistry is in full display. He continues his storied four decade career with continual reinvention and true conviction on his 11th album, "Juke Joint at the Edge of the World"\xa0on New West Records was released July 7th, 2017.Conjuring equal parts Tom Waits, Ray Charles, William Burroughs, and hallelujah chorus, his music again comes alive on this collection. The live show is thoroughly vibrant, with a top shelf band who command the stage and connect with the audience. With a commitment to the necessary mutation of music, Bramblett has kept his solo career as fresh as the day it began. And he\u2019s still in demand to create with the legends of rock, both on stage and lyrically. Reason #528 he is considered Georgia\u2019s Musical Treasure. \xa0\xa0\u201cYou can\u2019t do better than Randall Bramblett.\u201d\xa0\xa0Bonnie Raitt \xa0\u201cOne of the South\u2019s most lyrical and literate songwriters.\u201d\xa0\xa0Rolling Stone \xa0\u201cRandall is in my opinion the most gifted & talented southern singer-songwriter musicians of the past several decades.\u201d\xa0 Chuck Leavell\xa0(Rolling Stones, Allman Brothers) \xa0\u201cRandall Bramblett is the William Faulkner of Southern music\u201d \xa0Hittin\u2019 the Note \xa0\u201cRandall is one of Georgia\u2019s musical treasures\u201d \xa0\xa0\xa0Dave Schools\xa0\u2013\xa0Widespread Panic \xa0\u201cRandall is the most talented and prolific songwriter I have the privilege of knowing.\u201d\xa0\xa0Bill Berry (R.E.M. \u201cThis is music for people who like to think, and it delves the dark side of life and emotion with amazing musicianship and skill. Randall Bramblett is a genius.\u201d \xa0Rhetta Akamatsu, Blog Critics \u201cRandall Bramblett is the William Faulkner of Southern Music.\u201d Hittin\u2019 the Note Magazine\u201cThis is a cool album that combines the vibe of a real-as-hell vintage soulman with modern musical ideas.\u201d Jambands.com Don't miss the return of Randall and his fabulaous band to High Cotton Music Hall!\xa0This is a favorite show with our audiences, and a sellout would not be unusal - get you tickets now!! All sales are final - No refunds or exchanges ', 'start_time': '2018-01-12 20:00:00', 'calendars': None, 'venue_url': 'http://eventful.com/hartwell/venues/high-cotton-music-hall-/V0-001-003984905-5?utm_source=apis&utm_medium=apim&utm_campaign=apic', 'latitude': '34.3518048', 'groups': None, 'city_name': 'Hartwell', 'tz_city': None, 'tz_olson_path': None, 'performers': None, 'url': 'http://eventful.com/hartwell/events/randall-bramblett-band-/E0-001-108637459-0?utm_source=apis&utm_medium=apim&utm_campaign=apic', 'tz_id': None, 'all_day': '0', 'longitude': '-82.9333535', 'calendar_count': None, 'title': 'Randall Bramblett Band'}


"""
Exemple #6
0
 def registerEventfulAPI(self):
     return eventful.API(self.api_keys[EVENTFUL_API_KEY])
Exemple #7
0
 def __init__(self):
     self.api = eventful.API('fDJhdqLtn39Nbfcq')
     self.cache = None
Exemple #8
0
    def get_events(self):
        """
        Queries Eventful, LastFM, and Eventbrite APIs and returns events
        within an area based on geo parameters
        """

        # Datetime format for event start date/time
        datetime_format = '%b %d, %Y -- %I:%M %p'

        lst_events = []

        ###  -----  Eventful  -----   ###

        # Queries Eventful API and returns events within an area based on geo
        # parameters. Exception handling to prevent error in case no events
        # are found.
        api = eventful.API(Eventful_Key)
        try:
            eventful_events = api.call('/events/search',
                                       location=(str(self.latitude) + ',' +
                                                 str(self.longitude)),
                                       within=self.miles,
                                       sort_order="date")
        except:
            eventful_events = dict({'events': None})

        # Appends Eventful event details to 'lst_events' list. Two different
        # 'For Loops' are used because if only one event is found, it is returned
        # as a dict, otherwise it is returned as a list
        if eventful_events['events'] != None:
            if isinstance(eventful_events['events']['event'], list):
                for event in eventful_events['events']['event']:
                    tmp_event = []
                    tmp_time = []
                    tmp_event.append(event['title'][:35])
                    tmp_event.append(event['venue_name'][:20])
                    # converts datetime format
                    tmp_time = event['start_time']
                    tmp_time_adj = datetime.strptime(
                        tmp_time,
                        '%Y-%m-%d %H:%M:%S').strftime(datetime_format)
                    tmp_event.append(tmp_time_adj)
                    tmp_event.append(event['url'])
                    lst_events.append(tmp_event)

            elif isinstance(eventful_events['events']['event'], dict):
                tmp_event = []
                tmp_time = []
                tmp_event.append(
                    eventful_events['events']['event']['title'][:35])
                tmp_event.append(
                    eventful_events['events']['event']['venue_name'][:20])
                tmp_time = eventful_events['events']['event']['start_time']
                # converts datetime format
                tmp_time_adj = datetime.strptime(
                    tmp_time, '%Y-%m-%d %H:%M:%S').strftime(datetime_format)
                tmp_event.append(tmp_time_adj)
                tmp_event.append(eventful_events['events']['event']['url'])
                lst_events.append(tmp_event)

        ###  -----  LastFM  -----   ###

        # Queries LastFM API and returns events within an area based on geo
        # parameters. Exception handling to prevent error in case no events
        # are found.
        network = pylast.LastFMNetwork(api_key=Last_fm_Key,
                                       api_secret=Last_fm_Secret)
        try:
            lastfm_events = network.get_geo_events(longitude=self.longitude,
                                                   latitude=self.latitude,
                                                   distance=self.miles)
        except:
            lastfm_events = []

        # Appends LastFM event details to 'lst_events' list. Exception handling
        # in case no events are found or etracting certain event details creates
        # an error
        for i in range(len(lastfm_events)):
            try:
                tmp_event = []
                tmp_time = []
                tmp_event.append(lastfm_events[i].get_title())
                tmp_event.append(lastfm_events[i].get_venue().get_name())
                # converts datetime format
                tmp_time = lastfm_events[i].get_start_date()
                tmp_time_adj = datetime.strptime(
                    tmp_time,
                    '%a, %d %b %Y %H:%M:%S').strftime(datetime_format)
                tmp_event.append(tmp_time_adj)
                tmp_event.append(lastfm_events[i].get_url())
                lst_events.append(tmp_event)
            except:
                continue

        ###  -----  Eventbrite  -----   ###

        # Queries Eventbrite API and returns events within an area based on geo
        # parameters.
        eventbrite = Eventbrite(Eventbrite_API)
        # Eventbrite API requires radius ('within' param) to be integer
        # not less than 1.
        eventbrite_within = max('1', str(int(float(self.miles))))
        eventbrite_events = eventbrite.event_search(
            **{
                'location.within': eventbrite_within + "mi",
                'location.latitude': str(self.latitude),
                'location.longitude': str(self.longitude),
                'popular': 'true',
                'sort_by': 'date'
            })

        # Appends Eventbrite event details to 'lst_events' list. Exception handling
        # in case no events are found or extracting certain event details creates
        # an error
        for i in range(len(eventbrite_events)):
            try:
                tmp_event = []
                tmp_time = []
                tmp_event.append(
                    eventbrite_events['events'][i]['name']['text'][:35])
                tmp_event.append(
                    eventbrite_events['events'][i]['venue']['name'][:20])
                # converts datetime format
                tmp_time = eventbrite_events['events'][i]['start']['local']
                tmp_time_adj = datetime.strptime(
                    tmp_time, '%Y-%m-%dT%H:%M:%S').strftime(datetime_format)
                tmp_event.append(tmp_time_adj)
                tmp_event.append(eventbrite_events['events'][i]['url'])
                lst_events.append(tmp_event)
            except:
                continue

        # Events in lst_events are sorted by chronological order
        return sorted(lst_events,
                      key=lambda x: datetime.strptime(x[-2], datetime_format))


# x = GlocalAPI("1500 Massachusetts Ave NW", "washington","dc","1" )
# # # # x.get_instagram()
# x.get_events()
# # # # # y = GlocalAPI("","Sanaa","Yemen","10")
# # # y.get_events()
# # z = GlocalAPI("42 mar elias street","al-mina, tripoli", "lebanon","5")
# z.get_events()
def loadEvents(requests, city):
    """
    @Description:
    loadEvents will call eventful API to fetch events for each city and date, and store them into holiday_event table.

    """

    print("Call API for Events in City " + city)

    api = eventful.API('JmGWfK7NFTc4NvX7')

    #for multiple event categories:
    # categories=['art','business','sports','health','education','theatre']
    # cities=['Brussels','Chicago','Copenhagen','Denver','Dublin','Edinburgh','Geneva','London','Hong Kong']
    #
    # for city1 in cities:
    cursor = connection.cursor()
    # for category in categories:

    events_count = 0
    try:
        # for num in range(1,4):
        events = api.call('/events/search',
                          l=city,
                          t='2016050400-2017050300',
                          page_size=250,
                          page_number=4,
                          sort_order='popularity',
                          sort_direction='descending')
        # sort_order='popularity', sort_direction='descending'
        # t='2015100300-2016061400',

        for event in events['events']['event']:
            try:
                title = event['title']
                title = title + ", "
                venue_name = event['venue_name']
                start_time = event['start_time']
                start_date = start_time[0:10]
                # print start_date, title
                cursor.execute(
                    'INSERT INTO holiday_event \
                                    (date, city, event) \
                                VALUES \
                                    (%s, %s, %s) \
                                ON DUPLICATE KEY UPDATE \
                                    event = concat(event, %s);',
                    (start_date, city, title, title))
                connection.commit()
                events_count += 1
                # time.sleep(1)
            except Exception as detail:
                print(detail)
                # return HttpResponse(events_count)
                pass
    except Exception as detail:
        print(detail)
        return HttpResponse(events_count)
        pass
        # pass

        #cursor.execute('UPDATE calendar_summary SET happenings = concat(happenings, %s) WHERE city_name = %s AND date = %s', (title, search_string, start_date))

    return HttpResponse(events_count)
Exemple #10
0
# -*- coding: utf-8 -*-

from datetime import datetime
from decimal import *
from faker import Factory
import eventful
import random
import simplejson

# Dirty encoding trick...
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

#Api key
api = eventful.API('NGGMrssxfJT52ZSP')

# Create object factory with en_CA locale
fake = Factory.create('en_CA')
fake.seed('12345')

# Global variables
client_list = []
event_list = []
categ_list = []
empl_list = []
occurence_list = []
transaction_list = []
rabais_list = []
amtAdressCreated = 0
Exemple #11
0
    out = ""

    for c in s:
        if c == '<' and not quote:
            tag = True
        elif c == '>' and not quote:
            tag = False
        elif (c == '"' or c == "'") and tag:
            quote = not quote
        elif not tag:
            out = out + c

    return out


api = eventful.API('mm576kLMq5X9DRgt')
# api.login('username', 'password')
events = api.call('/events/search', l='Gurgaon')
events = api.call('/events/search',
                  l='Gurgaon',
                  page_size=(events['total_items']))
#print events
for e in events['events']['event']:
    (event, created) = Event.objects.get_or_create(eventid=e['id'])
    if not created: continue

    print 'Processing event: "%s"' % e['title']

    event.eventid = e['id']
    event.title = e['title']
    event.description = remove_html_markup(e['description'])
Exemple #12
0
import eventful

api = eventful.API('FTcN9qrSkd47hmpr')

events = api.call('/events/search', q='', l='London')
for event in events['events']['event']:
    print (event["url"],event["city_name"],event["longitude"],event["country_name"],event["start_time"], event["description"], event["performers"],event["venue_address"], event["title"])
import eventful
from config import *

# Create a config.py file with this structure:
#
# from collections import namedtuple
#
# config = namedtuple("config", "EVENTFUL_KEY")
# config.EVENTFUL_KEY = 'YOUR_EVENTFUL_API_KEY'
#
api = eventful.API(config.EVENTFUL_KEY)

# If you need to log in:
# api.login('username', 'password')

# Search for events with the following search criteria.
# Currently only prints.
# TODO: Save information to database to limit API calls.
#
events = api.call('/events/search',
                  category='livemusic',
                  l='Lawrence, KS',
                  sort_order='date',
                  page_size=100)

for event in events['events']['event']:
    print("######### %s ##########" % event['venue_name'])
    print("%s at %s \n\n" % (event['start_time'], event['title']))

#print(events);
# Search for events with the following search criteria.
Exemple #14
0
import eventful

event_info = eventful.API("key")
Exemple #15
0
import os
import eventful
api = eventful.API(os.environ["EVENTFUL_ID"])
import pickle

class Venue():
    def __init__(self, venue):
        self.name = venue['name']
        self.address = venue['address']
        self.city = venue['city_name']
        self.zip = venue['postal_code']
        self.id = venue['id']
        self.lat = venue['latitude']
        self.long = venue['longitude']
        self.url = venue['url']

class Events():
    def __init__(self, venueid):
        self.id = venueid
    def get_events(self):
        events = api.call('events/search', l=self.id)
        pages = int(events['page_count'])
        shows = []
        print self.id, '-----------'
        #print 'this venue has {} pages of events'.format(pages)
        for p in range(1, pages+1):
            page = api.call('events/search', l=self.id, page_number=p)
            for i in page['events']['event']:
                #shows[i['title']] = i['id']
                shows.append((i['title'].encode('utf-8'), i['id'], i['start_time']))
        return shows
Exemple #16
0
# -*- coding: utf-8 -*-
import sys
import eventful
import pprint

reload(sys)
sys.setdefaultencoding('utf-8')

#acasp key:
###79BBkzsdbbqBBr4W



api = eventful.API('79BBkzsdbbqBBr4W')

events = api.call('/events/search', q='music', location='Tel-Aviv', date='2017030100-2017030500', within='25')
for event in events['events']['event']:
    print("{} - performing - {} -  at - {} ".format(event['title'], event['description'], event['city_name']))
#pprint.pprint(events)

Exemple #17
0
def get_events(lat, lon, radius=5):
    coordinates = str(lat) + ',' + str(lon)
    api = eventful.API('L5TN3BsjGj9xFbtb')
    events = api.call('/events/search', location=(coordinates), within=radius)
    return json_parse(events)
Exemple #18
0
import eventful

api = eventful.API('API Key Required')

# If you need to log in:
# api.login('username', 'password')
# q= 'music', c='music',

events = api.call('/events/search',
                  q='tag: rock',
                  date='2019111500-2019111600',
                  category='concerts',
                  location='New York City',
                  within=10)

for event in events['events']['event']:
    # print (event['title'], event['city_name'], event['venue_name'], event['start_time'])
    print(events)
# >> This program gets event information from Eventful.
# q can be music or sports (or others, the tutorial does not give keywords).
# t can be This Week (excludes weekend), This Weekend (excludes week, except for Friday), This Month, or a date like (23+June+2017)
# though it seems to be not giving the events in the right date.
# t can also be Future (default), Past, Friday (or other days), Next Month and Next x days also don't seem to be working. <<

import eventful

# API key
api = eventful.API('zVLrtqPJwL4c55nX')

# API Call
events = api.call('/events/search',
                  q='music',
                  l='Dublin',
                  t='2016022800-2016023000',
                  sort_order='popularity')

# Prints the whole data received
print(events)

# Prints the data in treated format
for event in events['events']['event']:
    print('Title:', event['title'])
    print('Venue:', event['venue_name'])
    print('Start:', event['start_time'])
    print('End:', event['stop_time'])
    print('Full day/s:', event['all_day'])
    print('Address:', event['venue_address'])
    print('Longitude:', event['longitude'])
    print('Latitude:', event['latitude'])
Exemple #20
0
#!/usr/bin/env python

import eventful

api = eventful.API('test_key', cache='.cache')
# api.login('username', 'password')
events = api.call('/events/search', q='music', l='San Diego')

for event in events['events']['event']:
    print "%s at %s" % (event['title'], event['venue_name'])
Exemple #21
0
 def __process__(self, __input__):
   import eventful
   from datetime import datetime
   
   api = eventful.API(akira.config.eventful['api_key'])
   
   place = __input__[0]
   period = __input__[1]
   
   events = api.call('/events/search',
     l=quote_plus(place), sort_order='date',
     sort_direction='ascending', date=period.lower()
   )
   
   if not events or not 'events' in events or not events['events'] \
     or not 'event' in events['events']:
       return 'I couln\'t find any events in %s %s.' % (
         place.title(), period.lower()
       )
   
   event_list = []
   needed_keys = [
     'title', 'start_time', 'stop_time',
     'venue_name', 'venue_address', 'postal_code'
   ]
   
   if type(events['events']['event']) != list:
     events['events']['event'] = [events['events']['event']]
   
   for event in events['events']['event']:
     for __ in needed_keys:
       if not __ in event or not event[__]:
         event[__] = ''
         continue
       
       event[__] = event[__]
     
     if event['start_time']:
       event['start_time'] = datetime.strptime(
         event['start_time'], '%Y-%m-%d %H:%M:%S'
       ).strftime('%b %d, %H:%M')
     
     if event['stop_time']:
       event['stop_time'] = datetime.strptime(
         event['stop_time'], '%Y-%m-%d %H:%M:%S'
       ).strftime('%b %d, %H:%M')
     
     event_desc = '"{title}" which starts at {start_time}{when_ends}. ' \
       'The location for this event: {place_name} {place_loc}'.format(
         title = event['title'],
         start_time = event['start_time'],
         when_ends = ' and ends at %s' % event['stop_time'] if \
           event['stop_time'] else '',
         place_name = event['venue_name'],
         place_loc = '%s%s' % (
           'which is at %s' % event['venue_address'] if \
             event['venue_address'] else '',
           'postal code %s' % event['postal_code'] if \
             event['postal_code'] else ''
         )
       )
     
     event_list.append(event_desc.strip() + '.')
   
   header = 'There are {num_evs} events in {ev_place} {ev_per}.'.format(
     num_evs=events['total_items'],
     ev_place=place.title(),
     ev_per=period.lower()
   )
   
   if int(events['total_items']) > len(event_list):
     header = '%s Here is a list of 10 events happening soon:' % header
   
   response = '%s\n\n%s' % (header, '\n'.join(event_list))
   
   return response