Last active
June 8, 2023 22:32
-
-
Save zzstoatzz/be298d88bc99b68d8056ab8c13a5f25d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@flow(name="Store chess.com users' games", version="1.0.0") | |
def orca(filepath: str) -> None: | |
logger = get_run_logger() | |
for username in ['n80n8']: | |
logger.info(f"Checking for games on chess.com from: {username}") | |
# list of URLs to GET months of games from | |
archive_urls = get_player_game_archives(username=username).archives | |
new_user_games = [get_games(url) for url in archive_urls] | |
if len(new_user_games) == 0: | |
logger.info(f'No new months of games to load for {username}!') | |
continue | |
logger.info(f'Fetching {len(new_user_games) } new months of games from {username}..') | |
for month in new_user_games: | |
load_games( | |
games=month, | |
base_path=filepath | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment