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