Ejemplo n.º 1
0
			lng = location.longitude
			point = Point(lat,lng)
			if point_inside_polygon(point, cardiff_polygon):
				logging.info( 'retrieve details for venue: %s\n' % ( venue.name.encode('utf-8') ) )
				response = get_venue_details( venue.foursq_id )
				count_venues = count_venues + 1
				v = response.get( 'response' )
				v = v.get( 'venue' )
				stats = v.get( 'stats' )
				dbw.add_statistics_to_database(venue,stats)
				hereNow = v.get( 'hereNow' )
				count = hereNow.get( 'count' )
				logging.info( 'checkins found: %d\n' % ( count ) )
				if count > 0:
					count_venues_with_checkins = count_venues_with_checkins + 1
					response = api.query_resource( "venues", venue.foursq_id, "herenow" )
					hereNow = response['response']
					hereNow = hereNow['hereNow']
					items = hereNow['items']
					for item in items:
						count_checkins = count_checkins + 1
						logging.info( 'Adding checkin\n' )
						dbw.add_checkin_to_database(item, venue)
		logging.info( 'venues checked: %d\n' % ( count_venues ) )
		logging.info( 'venues with checkins: %d\n' % ( count_venues_with_checkins ) )
		logging.info( 'checkins: %d\n' % ( count_checkins ) )
		logging.info( 'total checkins in database: %d\n' % dbw.count_checkins_in_database() )