You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Error running in Jupyter which already has a running event loop
To Reproduce
Steps to reproduce the behavior:
Run the following code in Jupyter:
from secedgar.core import DailyFilings
from secedgar import client
from datetime import date
from secedgar.cik_lookup import get_cik_map
USER_AGENT = 'ambrus.com/sec-edgar/sec-edgar'
nc = client.NetworkClient(user_agent=USER_AGENT, rate_limit=5)
def get_form_4(filing_entry):
return filing_entry.form_type.lower() in ("3", "4")
daily_filings = DailyFilings(date=date(2022, 3, 10), client=nc, entry_filter=get_form_4)
ciks_map = get_cik_map()
daily_filings.save('./daily_filings/')
Expected behavior
You get the following error
576 def _check_running(self):
577 if self.is_running():
--> 578 raise RuntimeError('This event loop is already running')
579 if events._get_running_loop() is not None:
580 raise RuntimeError(
RuntimeError: This event loop is already running
Desktop (please complete the following information):
macOS
Additional context
Can be fixed with the following code in the last lines of _index.py
loop = asyncio.get_event_loop()
if not loop.is_running():
loop.run_until_complete(self.client.wait_for_download_async(inputs))
else:
loop.create_task(self.client.wait_for_download_async(inputs))
The text was updated successfully, but these errors were encountered:
Describe the bug
Error running in Jupyter which already has a running event loop
To Reproduce
Steps to reproduce the behavior:
Run the following code in Jupyter:
Expected behavior
You get the following error
Desktop (please complete the following information):
macOS
Additional context
Can be fixed with the following code in the last lines of _index.py
The text was updated successfully, but these errors were encountered: