eckendoerffer commited on
Commit
3f958b2
·
1 Parent(s): ac377b2

Update extract_news/2_extract_news.py

Browse files
Files changed (1) hide show
  1. extract_news/2_extract_news.py +4 -1
extract_news/2_extract_news.py CHANGED
@@ -51,7 +51,6 @@ async def fetch_and_save(url, id_source):
51
  async with aiohttp.ClientSession() as session:
52
  async with session.get(url) as response:
53
  byte_content = await response.read()
54
-
55
  try:
56
  text_content = byte_content.decode('utf-8')
57
  except UnicodeDecodeError:
@@ -62,6 +61,10 @@ async def fetch_and_save(url, id_source):
62
 
63
  except aiohttp.client_exceptions.TooManyRedirects:
64
  print(f"Too many redirects for URL: {url}")
 
 
 
 
65
 
66
 
67
  async def main():
 
51
  async with aiohttp.ClientSession() as session:
52
  async with session.get(url) as response:
53
  byte_content = await response.read()
 
54
  try:
55
  text_content = byte_content.decode('utf-8')
56
  except UnicodeDecodeError:
 
61
 
62
  except aiohttp.client_exceptions.TooManyRedirects:
63
  print(f"Too many redirects for URL: {url}")
64
+ except aiohttp.client_exceptions.ClientConnectorError:
65
+ print(f"Failed to connect to URL: {url}")
66
+ except Exception as e:
67
+ print(f"Unexpected error for URL {url}: {str(e)}")
68
 
69
 
70
  async def main():