def __init__(self, bot): self.bot = bot self.pyracing = pyracing.Client(os.getenv("IRACING_USERNAME"), os.getenv("IRACING_PASSWORD")) self.update_user = UpdateUser(self.pyracing, log) self.updater = Update(self.pyracing, log, self.update_user) self.recent_races = RecentRaces(self.pyracing, log) # self.last_series = LastSeries(self.pyracing, log) self.yearly_stats_db = YearlyStatsDb(self.pyracing, log) self.career_stats_db = CareerStatsDb(self.pyracing, log) self.save_id = SaveId(log) self.save_name = SaveName(self.pyracing, log) self.iratings_db = IratingsDb(log) self.all_series_db = AllSeriesDb(log) self.current_series_db = CurrentSeriesDb(log) self.set_fav_series = SetFavSeries(log) self.remove_fav_series = RemoveFavSeries(log) self.leaderboard_db = LeaderboardDb(log) self.save_league = SaveLeague(self.pyracing, log) self.remove_league = RemoveLeague(log) self.league_standings = LeagueStandings(self.pyracing, log) # self.migrate_fav_series.start() self.update_all_servers.start() self.update_series.start()
import asyncio import dotenv import logging import os import sys from pyracing import client as pyracing from pyracing import constants from pyracing.response_objects import career_stats, chart_data, iracing_data, \ upcoming_events, historical_data, session_data, league_data import unittest dotenv.load_dotenv() client = pyracing.Client(os.getenv('IRACING_USERNAME'), os.getenv('IRACING_PASSWORD')) logging.basicConfig(stream=sys.stdout, level=logging.INFO, datefmt="%Y-%m-%d %H:%M:%S", format="%(asctime)s;%(levelname)s;%(message)s") def async_test(f): def wrapper(*args, **kwargs): coro = asyncio.coroutine(f) future = coro(*args, **kwargs) loop = asyncio.get_event_loop() loop.run_until_complete(future) return wrapper
async def login(): client = pyracing.Client( os.getenv("IRACING_USERNAME"), os.getenv("IRACING_PASSWORD") ) return client