bgg_connection will now wait on BGG if it is processing
This commit is contained in:
parent
8b8a218bc5
commit
7927f2ced1
1 changed files with 7 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ import xml.etree.ElementTree as ET
|
||||||
from pydantic import HttpUrl
|
from pydantic import HttpUrl
|
||||||
import requests
|
import requests
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import time
|
||||||
|
|
||||||
from src.classes import boardgame_classes
|
from src.classes import boardgame_classes
|
||||||
from src.modules import auth_manager
|
from src.modules import auth_manager
|
||||||
|
|
@ -12,6 +13,12 @@ authenticated_session: requests.Session = requests.Session()
|
||||||
|
|
||||||
def url_to_xml_object(url: HttpUrl) -> ET.Element:
|
def url_to_xml_object(url: HttpUrl) -> ET.Element:
|
||||||
r = authenticated_session.get(url)
|
r = authenticated_session.get(url)
|
||||||
|
|
||||||
|
while r.status_code == 202:
|
||||||
|
print('BGG is processing...')
|
||||||
|
time.sleep(10)
|
||||||
|
r = authenticated_session.get(url)
|
||||||
|
|
||||||
assert r.status_code == 200, "Got {} status code".format(r.status_code)
|
assert r.status_code == 200, "Got {} status code".format(r.status_code)
|
||||||
root = ET.fromstring(r.content)
|
root = ET.fromstring(r.content)
|
||||||
return root
|
return root
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue