Revert "chg: Catch aiohttp.ClientError"

This reverts commit 9904404003.
pull/12/head
Raphaël Vinot 2018-04-04 23:41:22 +02:00
parent 9904404003
commit e00dfc3e3f
1 changed files with 9 additions and 12 deletions

View File

@ -133,18 +133,15 @@ class Fetcher():
if not await self.__newer(): if not await self.__newer():
unset_running('{}-{}-{}'.format(self.__class__.__name__, self.vendor, self.listname)) unset_running('{}-{}-{}'.format(self.__class__.__name__, self.vendor, self.listname))
return return
try: async with aiohttp.ClientSession() as session:
async with aiohttp.ClientSession() as session: async with session.get(self.url) as r:
async with session.get(self.url) as r: content = await r.content.read()
content = await r.content.read() if self.__same_as_last(content):
if self.__same_as_last(content): return
return self.logger.info('Got a new file \o/')
self.logger.info('Got a new file \o/') with (self.directory / '{}.txt'.format(datetime.now().isoformat())).open('wb') as f:
with (self.directory / '{}.txt'.format(datetime.now().isoformat())).open('wb') as f: f.write(content)
f.write(content) unset_running('{}-{}-{}'.format(self.__class__.__name__, self.vendor, self.listname))
unset_running('{}-{}-{}'.format(self.__class__.__name__, self.vendor, self.listname))
except aiohttp.ClientError as e:
self.logger.exception('Fetching the list failed: {}'.format(e))
except PidFileError: except PidFileError:
self.logger.info('Fetcher already running') self.logger.info('Fetcher already running')
finally: finally: