#!/usr/bin/env python from collector import Collector import sys debug = len(sys.argv) > 1 and sys.argv[1] == '-d' collector = Collector('config/venues.yml', 'venue_parsers', debug) shows = collector.scrape_sites() for venue, venue_shows in shows.items(): print venue for show in venue_shows: print '\t', show['headliner'] if 'openers' in show: print '\t\t', show['openers'] print '\t\t(', show['time'], ') ', show['date']
#!/usr/bin/env python from collector import Collector from jinja2 import Environment, FileSystemLoader import sys env = Environment(loader=FileSystemLoader('templates')) template = env.get_template('rentals.html') debug = len(sys.argv) > 1 and sys.argv[1] == '-d' collector = Collector('config/agencies.yml', 'agency_parsers', debug) collector.load_log('rentals') agency_listings = collector.scrape_sites() for agency, listings in agency_listings.items(): print agency.capitalize().replace('_', ' ') for listing in listings: print '\t', listing['title'] print '\t\tPrice: ', listing['price'] print '\t\tAddress: ', listing['address'] print '\t\tBed/Bath: ', listing['bed/bath'] print '\t\tSize: ', listing['size'], ' sq ft' print '\t\tURL: ', listing['url'] collector.write_log(agency_listings, 'rentals') rendered_page = template.render(agency_listings=agency_listings) f = open('rentals.html', 'w')