Skip to content

Commit

Permalink
fix uvloop errors in notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorhobenshield committed Apr 23, 2023
1 parent 6b6ad28 commit 61a9789
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/favoriters_and_retweeters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"import pandas as pd\n",
"import polars as pl\n",
"\n",
"from twitter.utils import find_key"
"from twitter.util import find_key"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/tweets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"import pandas as pd\n",
"\n",
"from twitter.scraper import Scraper\n",
"from twitter.utils import find_key"
"from twitter.util import find_key"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setup(
name="twitter-api-client",
version="0.7.4",
version="0.7.5",
python_requires=">=3.11.0",
description="Twitter API",
long_description=dedent('''
Expand Down
5 changes: 2 additions & 3 deletions twitter/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
if platform.system() != 'Windows':
try:
import uvloop

uvloop.install()
except ImportError as e:
...

Expand Down Expand Up @@ -132,9 +134,6 @@ def users_by_ids(self, user_ids: list[int]) -> dict:
return data

def _run(self, ids: list[int | str], operation: tuple, limit=None):
if platform.system() != 'Windows':
with asyncio.Runner(loop_factory=uvloop.new_event_loop) as runner:
return runner.run(self._process(ids, operation, limit))
return asyncio.run(self._process(ids, operation, limit))

async def _process(self, ids: list[int | str], op: tuple, limit: int | None) -> list:
Expand Down

0 comments on commit 61a9789

Please sign in to comment.