def get(self): logger = logging.getLogger('ClubSearch') id = self.get_argument('id', None) abbr = self.get_argument('abbr', None) try: clubs = get_clubs(id, abbr) result_obj = [club.search_listing() for club in clubs] except Exception, e: logger.exception(e) Session().rollback() result_obj = {}
def get(self): logger = logging.getLogger('MatchupHistory') if "club_id" in self.cookies: club_1_id = self.get_cookie("club_id", 0) else: club_1_id = self.get_argument('club_1_id') club_2_id = self.get_argument('club_2_id') try: clubs = [get_clubs(id)[0] for id in [club_1_id, club_2_id]] result_obj = get_matchup_history(clubs) except Exception, e: logger.exception(e) Session().rollback() result_obj = {}
def get(self): logger = logging.getLogger('MatchupHistory') club_id = self.get_argument('club_id', None) if club_id is None: club_id = self.get_cookie("club_id") else: club_id = self.get_argument('club_id') try: club = get_clubs(club_id)[0] result_obj = get_match_history(club) except Exception, e: logger.exception(e) Session().rollback() result_obj = {}
def get(self): logger = logging.getLogger('MatchupHistory') ea_id = self.get_argument('ea_id') try: club = get_clubs(ea_id=ea_id) if len(club) == 0: import_games(ea_id, 0, 0) else: club = club[0] most_recent_game = club.get_games(1)[0] dt = datetime.datetime.fromtimestamp(float(most_recent_game.ea_page_timestamp)) days_from_start = (dt - datetime.datetime.fromtimestamp(float(earliest_timestamp))).days - 1 import_games(club.ea_id, days_from_start, 0) result_str = 'success' except Exception, e: logger.exception(e) Session().rollback() result_str = e.message
from gamelistscraper import import_games, earliest_timestamp from models import get_clubs from sqlalchemy.sql.functions import current_date import datetime import logging # logger = logging.getLogger('ImportJob') d = datetime.datetime.now() if d.hour in range (0, 8) or d.hour in range(22,25):#only run during these hours (heroku server seems to be eastern + 4?) if d.minute in range(0, 10) or d.minute in range(20,30) or d.minute in range(40,50): our_club = get_clubs(1)[0] most_recent_game = our_club.get_games(1)[0] dt = datetime.datetime.fromtimestamp(float(most_recent_game.ea_page_timestamp)) days_from_start = (dt - datetime.datetime.fromtimestamp(float(earliest_timestamp))).days - 1 import_games(our_club.ea_id, days_from_start, 0) else: logger.info('Skipping import because minutes are %d' % d.minute) else: logger.info('Skipping import because hour is %d' % d.hour)