파이썬 스크립트 - chess.com API 튜토리얼
5470 단어 toolprogrammingpythontutorial
이를 위해서는 chess.com이라는 모듈이 필요합니다.
이것을 설치하려면 터미널을 열고 이 명령을 실행하십시오.
pip install chess.com
소스 코드 -
특사-VC / Python 스크립트
멋진 Python 스크립트의 선별된 목록입니다.
Python 스크립트
멋진 Python 스크립트의 선별된 목록입니다.
View on GitHub
from chessdotcom import get_leaderboards , get_player_stats , get_player_game_archives
import pprint
import requests
printer = pprint.PrettyPrinter()
def get_leaderboard():
data = get_leaderboards().json
categories = data['leaderboards']
daiy_leaderboards = categories['daily']
for i in daiy_leaderboards:
print(f" {i['rank']} | Username = {i['username']} | Score = {i['score']}")
def get_player_ratings(username):
data = get_player_stats(username).json
print(f"Ratings = {data['stats']['chess_blitz']['last']['rating']}")
def get_most_recent_game(username):
data = get_player_game_archives(username).json
url = data['archives'][-1]
games = requests.get(url).json()
last_game_played = games['games'][-1]
printer.pprint(last_game_played)
get_leaderboard()
get_player_ratings('cschess')
get_most_recent_game('cschess')
내 YouTube 채널 구독 -
↤↤↤↤↤↤↤↤↤↤ 🆂🆄🅿🅿🅾🆁🆃 🅼🅴 ↦↦↦↦↦↦↦↦↦↦
► 비트코인 - bc1q832u7flm5uylpqq68ehrxwfqyfq9tgmln8pg9d
아니면 그냥
► Say Thanks
Reference
이 문제에 관하여(파이썬 스크립트 - chess.com API 튜토리얼), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/envoy_/python-scripts-chess-com-api-tutorial-dfd
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
from chessdotcom import get_leaderboards , get_player_stats , get_player_game_archives
import pprint
import requests
printer = pprint.PrettyPrinter()
def get_leaderboard():
data = get_leaderboards().json
categories = data['leaderboards']
daiy_leaderboards = categories['daily']
for i in daiy_leaderboards:
print(f" {i['rank']} | Username = {i['username']} | Score = {i['score']}")
def get_player_ratings(username):
data = get_player_stats(username).json
print(f"Ratings = {data['stats']['chess_blitz']['last']['rating']}")
def get_most_recent_game(username):
data = get_player_game_archives(username).json
url = data['archives'][-1]
games = requests.get(url).json()
last_game_played = games['games'][-1]
printer.pprint(last_game_played)
get_leaderboard()
get_player_ratings('cschess')
get_most_recent_game('cschess')
Reference
이 문제에 관하여(파이썬 스크립트 - chess.com API 튜토리얼), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/envoy_/python-scripts-chess-com-api-tutorial-dfd텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)