player_tools_simple.cpython-311.pyc•4.85 kB
�
g�[h" � �L � d Z ddlmZmZmZ ddlZddlZddlZddlZddl Z e j
� dej
� ej
� e
� � � � � � ddlmZmZ dedeeef fd�Zdedeeef fd�Zdedeeef fd �ZdS )
z6
Simplified Chess.com player tools without analytics.
� )�Dict�Any�ListN)�
API_CONFIG� CACHE_TTL�username�returnc � � K � t j dd� � }|� d| � �} t j � � 4 �d{V ��}|� |� � � d{V ��}|� � � |� � � cddd� � �d{V �� S # 1 �d{V ��swxY w Y dS # t $ r}ddt |� � � �icY d}~S d}~ww xY w)z�
Get a player's profile information from Chess.com.
Args:
username: The Chess.com username
Returns:
Player profile data including join date, status, followers, etc.
�base_url�https://api.chess.com/pub�/player/N�errorz Failed to fetch player profile: �r �get�httpx�AsyncClient�raise_for_status�json� Exception�str�r r �endpoint�client�response�es �3/home/yori/chess-mxcp/python/player_tools_simple.py�get_player_profiler s� � � � � �~�j�*E�F�F�H��.�.�H�.�.�H�F��$�&�&� #� #� #� #� #� #� #�&�#�Z�Z��1�1�1�1�1�1�1�1�H��%�%�'�'�'��=�=�?�?� #� #� #� #� #� #� #� #� #� #� #� #� #� #� #� #� #� #� #� #� #� #� #� #���� #� #� #� #� #� #�� � F� F� F��D�C��F�F�D�D�E�E�E�E�E�E�E�����F���sA �B"