Started work on getting single boardgame from boardgamegeek
This commit is contained in:
parent
bfc5adac70
commit
d2fa2774eb
1 changed files with 7 additions and 0 deletions
|
|
@ -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)
|
||||
Loading…
Reference in a new issue