mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Retry crawling on I/O failure
This commit is contained in:
parent
9fd356d290
commit
cf6903d109
@ -596,12 +596,15 @@ class IliasCrawler(HttpCrawler):
|
|||||||
# TODO: Proper exception
|
# TODO: Proper exception
|
||||||
raise RuntimeError("Get page failed too often")
|
raise RuntimeError("Get page failed too often")
|
||||||
print(url)
|
print(url)
|
||||||
|
try:
|
||||||
async with self.session.get(url) as request:
|
async with self.session.get(url) as request:
|
||||||
soup = soupify(await request.read())
|
soup = soupify(await request.read())
|
||||||
if self._is_logged_in(soup):
|
if self._is_logged_in(soup):
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
await self._shibboleth_login.login(self.session)
|
await self._shibboleth_login.login(self.session)
|
||||||
|
except Exception:
|
||||||
|
return await self._get_page(url, retries_left - 1)
|
||||||
|
|
||||||
return await self._get_page(url, retries_left - 1)
|
return await self._get_page(url, retries_left - 1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user