Example #1
0
    def parse_page(self, events_json):
        result = []
        map_client = MapClient()
        for event in events_json['discover_events']:
            if not event['address']:
                continue
            address_dict = map_client.breakdown_address(event['address'])
            if not address_dict:
                continue

            curr_event = Event()
            curr_event.name = helpers.clean_string(event['title'])
            curr_event.description = helpers.clean_string(event['description'])
            curr_event.date = parser.parse(event['start_time'])
            curr_event.place = event['location']
            curr_event.address1 = address_dict['address1']
            curr_event.address2 = None
            curr_event.city = address_dict['city']
            curr_event.state = address_dict['state']
            curr_event.zipcode = address_dict['zipcode']
            curr_event.cost = 0 if not event['price'] else event['price']
            curr_event.link = event['ticket_url']
            curr_event.api = 'https://www.universe.com/api/v2/event_id/' + str(event['id'])
            curr_event.source = self.source
            curr_event.api_id = event['id']
            result.append(curr_event)
        return result
Example #2
0
 def parse_page(self, events_json):
     result = []
     for event in events_json['events']['event']:
         curr_event = Event()
         curr_event.name = helpers.clean_string(event['title'])
         description = helpers.clean_string(event['description'])
         if not description:
             curr_event.description = self.get_alt_description(event['id'])
         curr_event.date = datetime.datetime.strptime(event['start_time'], "%Y-%m-%d %H:%M:%S")
         curr_event.place = event['venue_name']
         curr_event.address1 = helpers.clean_address(event['venue_address'])
         curr_event.address2 = None
         curr_event.city = helpers.clean_city(event['city_name'])
         curr_event.state = event['region_abbr']
         curr_event.zipcode = event['postal_code']
         curr_event.cost = 0 if 'cost' not in event else event['cost']
         curr_event.link = event['url']
         curr_event.api = 'http://api.eventful.com/json/events/get?app_key=' + self.token + '&id=' + event['id']
         curr_event.source = self.source
         curr_event.api_id = event['id']
         result.append(curr_event)
     return result
    def get_event_loc(self, event_id):
        response = self._get('api2/eventlist', {
            'event_id': event_id,
            'id': self.token
            })
        event = ElementTree.fromstring(response.text.encode('utf-8')).find('event')

        result = Event()
        result.name = helpers.clean_string(event.find('title').text)
        result.description = ' '.join([
            helpers.clean_string(event.find('description').text),
            helpers.clean_string(event.find('e_description').text)
        ])
        result.place = helpers.clean_address(event.find('e_address1').text)
        result.address1 = helpers.clean_address(event.find('e_address2').text)
        result.city = helpers.clean_city(event.find('e_city').text)
        result.state = event.find('e_state').text
        result.zipcode = event.find('e_zip').text
        result.link = event.find('link').text
        result.api = [response.url]
        result.source = 'Brown Paper Tickets'
        result.api_id = event_id
        return result