# 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
)Add a code snippet to your website: www.paste.org