Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.

Paste

Pasted as Python by Ernst_Weiss ( 6 years ago )
# This downloads your last played game and opens it in the Chess software which is assigned to pgn files.
# Tested on Windows, Python 3 installed and 'pip install request' done in a console.

import requests
from pathlib import Path
from subprocess import Popen

username = 'your username'
saveto = Path('C:/Lichess/Last Game.pgn')
saveto.resolve().touch()

r = requests.get(f'https://lichess.org/api/games/user/{username}?max=1')
saveto.write_bytes(r.content)

Popen(
    [str(saveto)],
    shell=True
)

 

Revise this Paste

Your Name: Code Language: