FireHead90544/craiyon.py

Mimetype error with async functions

brett-cohen opened this issue · 8 comments

The switch to CloudScraper worked for the standard generate function. However, the async functions are still throwing Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8'.

Recommend using a library like aiocfscrape to support CloudScraper's functionality for the async functions.

I have been looking for something similar to aiocfscrape for such a long time. Thanks for the suggestion!

@FireHead90544 Think we should implement it?

The switch to CloudScraper worked for the standard generate function. However, the async functions are still throwing Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8'.

Recommend using a library like aiocfscrape to support CloudScraper's functionality for the async functions.

Oh so that's it, I totally forgot about the async-calls. That's a great idea.

I have been looking for something similar to aiocfscrape for such a long time. Thanks for the suggestion!

@FireHead90544 Think we should implement it?

Yea, I guess we should go with it.

How to solve this problem if my discord bot returns this error?

How to solve this problem if my discord bot returns this error?

Will be updating the logic for async calls soon using aiocfscrape or alternative probably

Will be updating the logic for async calls soon using aiocfscrape or alternative probably

And when will the fix be released?

Can you make an example for me pls?

Refer to this comment regarding more details: #19 (comment)

TL;DR: Removed the cloudscraper dependency and switched to using headers. v3 works normally, v1 sometimes fails.

Update the wrapper by running: pip install -U craiyon.py

Reopen the issue if this issue still persists