From d2fa2774eb71520dcf8fbde5de73eebf939f9c2d Mon Sep 17 00:00:00 2001 From: Yarne Coppens Date: Thu, 25 Jul 2024 21:52:49 +0200 Subject: [PATCH] Started work on getting single boardgame from boardgamegeek --- bgg_connection.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bgg_connection.py b/bgg_connection.py index 2244d60..12e36d6 100644 --- a/bgg_connection.py +++ b/bgg_connection.py @@ -2,7 +2,14 @@ import requests import xml.etree.ElementTree as ET from pydantic import HttpUrl +from classes.boardgame import BoardGame, BoardGameExpansion + def url_to_xml_object(url: HttpUrl) -> ET.Element: r = requests.get(url) root = ET.fromstring(r.content) return root + + +def get_boardgame(boardgame_id: int) -> BoardGame: + url : str = "https://boardgamegeek.com/xmlapi2/thing?id={}&stats=true".format(boardgame_id) + boardgame_xml_object : ET.Element = url_to_xml_object(url) \ No newline at end of file