Closed IntelligenzaArtificiale closed 9 months ago
Refer to this issue: #17 Will be trying to update asap
Hi, there's news? I keep getting this error.
generated_images = await generator.async_generate(prompt)
File "C:\Program Files\Python310\lib\site-packages\craiyon\craiyon.py", line 76, in async_generate resp = await resp.json() File "C:\Program Files\Python310\lib\site-packages\aiohttp\client_reqrep.py", line 1104, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://api.craiyon.com/v3')
Do you an example with aiocfscrape?
Hi guys. I have the same problem using call async. Here is more information <ClientResponse(api_url) [403 Forbidden]> <CIMultiDictProxy('Date': 'Fri, 27 Oct 2023 00:16:41 GMT', 'Content-Type': 'text/html; charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'max-age=15', 'Expires': 'Fri, 27 Oct 2023 00:16:56 GMT', 'Set-Cookie': '__cf_bm=Uefam2y9XxIuOusIhlihIjiwPpUx6oN4QAxT2O9Kx1s-1698365801-0-AcD2FIT4Ij2wBjMscSR8gkK2FK3agmtpoUgNuSIL7mawOAylw37/QgHS2MDTgD9tfaYtTl1nWP/GXnnUu0T3V0A=; path=/; expires=Fri, 27-Oct-23 00:46:41 GMT; domain=.craiyon.com; HttpOnly; Secure; SameSite=None', 'Vary': 'Accept-Encoding', 'expect-ct': 'max-age=86400, enforce', 'referrer-policy': 'same-origin', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '1; mode=block', 'Server': 'cloudflare', 'CF-RAY': '81c6c0736dff4952-TPA', 'Content-Encoding': 'gzip')>
If anyone know how to solve it, please help me.
generator = Craiyon()
result = await generator.async_generate(prompt)
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://api.craiyon.com/v3')
generator = Craiyon() result = await generator.async_generate(prompt)
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://api.craiyon.com/v3')
did you solve it or what ??
Just released v1.2.0.
Removed the cloudscraper
dependency and switched to using headers. v1
and v3
endpoints are now working as expected. I didn't perform many tests but v3
seems to work normally (5/5 passes) while v1
(2/5 passes) sometimes seems to cause JSONDecodeError
because of cloudflare's security page. So I'd suggest either use it inside a try-catch block and repeat the request or just don't use the v1 model.
Update your wrappers by running pip install -U craiyon.py
, and reopen the issue if you think the problem still persists.
Hi guys, i have a problem.
I have try v3 and v1 in all version ( async and not) and the result is always this .
How i can resolve ?