Python Forum
Get event details from eventful api
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get event details from eventful api
#1
Im trying to use the eventful api to get information about music events (concerts) between two dates. For example I want to get the below information about each concert from 20171012 to 20171013:

- city
- performer
- country
- genre
- title
- image
- StarTime

Im using a python example available online and change it to get the data above. But for now its not working Im just able to get this information:

{'latitude': '40.4',
'longitude': '-3.68333',
'start_time': '2017-10-12 20:00:00',
'city_name': 'Madrid', 'title': 'Kim Waters & Maysa Smooth en Hot Jazz Festival'}

But the performer, genre country and image its not working. Do you know how to get that information? When I change the python example below to get this information it returns always a empty array.

python example working: (However, without getting the performer, genre, country and image url, because if i add these I got an empty array)


       import requests
       import datetime
    
    def get_event(user_key, event_location , start_date, end_date, event_features, fname):
    
        data_lst = []  # output
        start_year = int(start_date[0:4])
        start_month = int(start_date[4:6])
        start_day = int(start_date[6:])
    
        end_year = int(end_date[0:4])
        end_month = int(end_date[4:6])
        end_day = int(end_date[6:])
    
        start_date = datetime.date(start_year, start_month, start_day)
        end_date = datetime.date(end_year, end_month, end_day)
        step = datetime.timedelta(days=1)
    
        while start_date <= end_date:
    
            date = str(start_date.year)
            if start_date.month < 10:
                date += '0' + str(start_date.month)
            else:
                date += str(start_date.month)
    
            if start_date.day < 10:
                date += '0' + str(start_date.day)
            else:
                date += str(start_date.day)
            date += "00"
            date += "-" + date
    
            url = "http://api.eventful.com/json/events/search?"
            url += "&app_key=" + user_key
            url += "&location=" + event_location
            url += "&date=" + date
            url += "&page_size=250"
            url += "&sort_order=popularity"
            url += "&sort_direction=descending"
            url += "&q=music"
            url+= "&c=music"
    
            data = requests.get(url).json()
    
            try:
                for i in range(len(data["events"]["event"])):
                    data_dict = {}
                    for feature in event_features:
                        data_dict[feature] = data["events"]["event"][i][feature]
                    data_lst.append(data_dict)
            except:
                pass
    
            print(data_lst)
            start_date += step
    
    
    def main():
    
        user_key = ""
        event_location = "Madrid"
        start_date = "20171012"
        end_date = "20171013"
        event_location = event_location.replace("-", " ")
        start_date = start_date
        end_date = end_date
        event_features = ["latitude", "longitude", "start_time"]
        event_features += ["city_name", "title"]
        event_fname = "events.csv"
    
        get_event(user_key, event_location, start_date, end_date, event_features, event_fname)
    
    
    if __name__ == '__main__':
        main()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to add product details in exe generated by pyinstaller arex786 1 8,253 Oct-10-2021, 11:00 AM
Last Post: Sran012
  How to get file name without the full path details and without extension aruncom2006 1 5,848 Jan-13-2020, 07:37 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020