bugfixing

This commit is contained in:
MuslemRahimi 2024-11-19 00:54:19 +01:00
parent e33ff80ba1
commit f5dc885817

View File

@ -265,8 +265,8 @@ def create_politician_db(data, stock_symbols, stock_raw_data, etf_symbols, etf_r
sector_list.append(sector) sector_list.append(sector)
if industry: if industry:
industry_list.append(industry) industry_list.append(industry)
except: except Exception as e:
pass print(e)
# Get the top 3 most common sectors and industries # Get the top 3 most common sectors and industries
sector_counts = Counter(sector_list) sector_counts = Counter(sector_list)
@ -378,7 +378,7 @@ async def run():
crypto_con.close() crypto_con.close()
total_symbols = crypto_symbols +etf_symbols + stock_symbols total_symbols = crypto_symbols +etf_symbols + stock_symbols
chunk_size = 200 chunk_size = 100
politician_list = [] politician_list = []
except Exception as e: except Exception as e:
@ -386,8 +386,7 @@ async def run():
return return
try: try:
connector = aiohttp.TCPConnector(limit=100) # Adjust the limit as needed
connector = aiohttp.TCPConnector(limit=200) # Adjust the limit as needed
async with aiohttp.ClientSession(connector=connector) as session: async with aiohttp.ClientSession(connector=connector) as session:
for i in tqdm(range(0, len(total_symbols), chunk_size)): for i in tqdm(range(0, len(total_symbols), chunk_size)):
try: try:
@ -395,7 +394,7 @@ async def run():
data = await get_congress_data(symbols_chunk,session) data = await get_congress_data(symbols_chunk,session)
politician_list +=data politician_list +=data
print('sleeping') print('sleeping')
await asyncio.sleep(10) await asyncio.sleep(30)
except Exception as e: except Exception as e:
print(e) print(e)
pass pass
@ -411,4 +410,3 @@ try:
asyncio.run(run()) asyncio.run(run())
except Exception as e: except Exception as e:
print(e) print(e)