Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no current event loop in thread 'main_task' #58

Open
benjaminu opened this issue Mar 2, 2022 · 3 comments
Open

There is no current event loop in thread 'main_task' #58

benjaminu opened this issue Mar 2, 2022 · 3 comments

Comments

@benjaminu
Copy link

benjaminu commented Mar 2, 2022

I keep getting this issue, can you help please?
There is no current event loop in thread 'main_task'.

cookie = {
    's_v_web_id': verify_fp,
    'tt_webid': tt_web_id
}
tiktok = TikTokAPI(cookie=cookie)
print(tiktok.getTrending(5))

It appears to fail here print(tiktok.getTrending(5))

Python 3.7.2
pip 22.0.3
@benjaminu
Copy link
Author

I cloned the repo and tracked the issue to here.

    def fetch_auth_params(self, url, language='en'):
        return asyncio.get_event_loop().run_until_complete(self.async_fetch_auth_params(url, language))

It fails on get_event_loop(). Challenge is I do not know how to use the asyncio, so not sure how to debug further.

@alex-philippov
Copy link

Did you try nest_asyncio.apply() before creating TikTokAPI? from nest_asyncio package?

@bhargavsonagara
Copy link

use this
return asyncio.new_event_loop().run_until_complete(self.async_fetch_auth_params(url, language))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants