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

cause of "EmptyResponseException: None -> TikTok returned an empty response" error #1116

Open
calvin-walters opened this issue Feb 15, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@calvin-walters
Copy link

Does anyone know what the cause of the ultra-common "EmptyResponseException: None -> TikTok returned an empty response" error is?

This article states that "TikTok's free APIs have usage restrictions. The commercial content API allows a maximum of 600 requests per day."

Is the "EmptyResponseException: None -> TikTok returned an empty response" error caused by a rate limit?

@calvin-walters calvin-walters added the bug Something isn't working label Feb 15, 2024
@angelopouloschristos
Copy link

Same error

@angelopouloschristos
Copy link

Temporary fix to it : in "tiktok.py" line 206, change headless=True, to false.

@Kkordik
Copy link
Contributor

Kkordik commented Apr 1, 2024

Temporary fix to it : in "tiktok.py" line 206, change headless=True, to false.

Or you can simply specify headless=False at api.create_sessions() :

from TikTokApi import TikTokApi
import asyncio
import os

ms_token = os.environ.get("ms_token", None) # get your own ms_token from your cookies on tiktok.com

async def trending_videos():
    async with TikTokApi() as api:
        await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3, headless=False)
        async for video in api.trending.videos(count=30):
            print(video)
            print(video.as_dict)

asyncio.run(trending_videos())

This worked for me. But I hope will be better fix

@Kkordik
Copy link
Contributor

Kkordik commented Apr 1, 2024

View the working solution at:
#1090 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants