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

Unhandled exception when retrying in headed mode #34

Open
GalenReich opened this issue Jun 5, 2024 · 0 comments
Open

Unhandled exception when retrying in headed mode #34

GalenReich opened this issue Jun 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@GalenReich
Copy link
Contributor

Reported through Discord

The user invoked tiktok-hashtag-analysis notcoin --number 20 --plot which should not obviously cause any issues.

Currently, if TikTok returns no results when retrying in headed it raises the `EmptyResponseException'. This exception is not handled and the user gets a large traceback.

It would be good if this error was handled, this is the relevant code block:

# Attempt to be robust against TikTok's countermeasures for headless browsing
try:
fetched_data = asyncio.run(
_fetch_hashtag_data(hashtag=hashtag, limit=limit, headed=headed)
)
except Exception as e:
logger.warning(
f"Encountered error {e} when fetching data, retrying in headed mode"
)
fetched_data = asyncio.run(
_fetch_hashtag_data(hashtag=hashtag, limit=limit, headed=True)
)

Because these TikTok returned an empty response errors seem to be fairly frequent, I wonder if it would be good to rework the error message to give the user more context about why it happens.

@GalenReich GalenReich added the bug Something isn't working label Jun 5, 2024
@GalenReich GalenReich changed the title Unhandled exception when retying in headed mode Unhandled exception when retrying in headed mode Jun 5, 2024
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

1 participant