It works, but need some retries, and I want to find the source of it, network, or the code.
Does it always require proxie, cookies or sth?
async with Network(proxies=None, verify_ssl=True) as client:
ascii2d = Ascii2D(
client=client, bovw=False
)
resp = await ascii2d.search(file=pic)
selected = None
for i in resp.raw:
if i.author_url.startswith("https://twitter"):
selected = i
break
return selected
Traceback (most recent call last):
File "E:\GradioThing\venv\lib\site-packages\anyio\streams\tls.py", line 131, in _call_sslobject_method
result = func(*args)
File "D:\Python\lib\ssl.py", line 975, in do_handshake
self._sslobj.do_handshake()
ssl.SSLWantReadError: The operation did not complete (read) (_ssl.c:997)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\GradioThing\venv\lib\site-packages\httpcore\_backends\anyio.py", line 69, in start_tls
ssl_stream = await anyio.streams.tls.TLSStream.wrap(
File "E:\GradioThing\venv\lib\site-packages\anyio\streams\tls.py", line 123, in wrap
await wrapper._call_sslobject_method(ssl_object.do_handshake)
File "E:\GradioThing\venv\lib\site-packages\anyio\streams\tls.py", line 138, in _call_sslobject_method
data = await self.transport_stream.receive()
File "E:\GradioThing\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 1203, in receive
await self._protocol.read_event.wait()
File "D:\Python\lib\asyncio\locks.py", line 214, in wait
await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\GradioThing\venv\lib\site-packages\httpcore\_exceptions.py", line 10, in map_exceptions
yield
File "E:\GradioThing\venv\lib\site-packages\httpcore\_backends\anyio.py", line 78, in start_tls
raise exc
File "E:\GradioThing\venv\lib\site-packages\httpcore\_backends\anyio.py", line 68, in start_tls
with anyio.fail_after(timeout):
File "E:\GradioThing\venv\lib\site-packages\anyio\_core\_tasks.py", line 119, in __exit__
raise TimeoutError
TimeoutError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\GradioThing\venv\lib\site-packages\httpx\_transports\default.py", line 66, in map_httpcore_exceptions
yield
File "E:\GradioThing\venv\lib\site-packages\httpx\_transports\default.py", line 366, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "E:\GradioThing\venv\lib\site-packages\httpcore\_async\connection_pool.py", line 262, in handle_async_request
raise exc
File "E:\GradioThing\venv\lib\site-packages\httpcore\_async\connection_pool.py", line 245, in handle_async_request
response = await connection.handle_async_request(request)
File "E:\GradioThing\venv\lib\site-packages\httpcore\_async\http_proxy.py", line 317, in handle_async_request
stream = await stream.start_tls(**kwargs)
File "E:\GradioThing\venv\lib\site-packages\httpcore\_backends\anyio.py", line 66, in start_tls
with map_exceptions(exc_map):
File "D:\Python\lib\contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "E:\GradioThing\venv\lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectTimeout
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:\GradioThing\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "E:\GradioThing\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
result = await self.call_function(
File "E:\GradioThing\venv\lib\site-packages\gradio\blocks.py", line 1101, in call_function
prediction = await fn(*processed_input)
File "E:\GradioThing\venv\lib\site-packages\gradio\utils.py", line 682, in async_wrapper
response = await f(*args, **kwargs)
File "E:\GradioThing\webui.py", line 235, in illu_getter
resp = await ascii2d.search(file=pic)
File "E:\GradioThing\venv\lib\site-packages\PicImageSearch\ascii2d.py", line 72, in search
resp = await self.post(ascii2d_url, files=files)
File "E:\GradioThing\venv\lib\site-packages\PicImageSearch\network.py", line 228, in post
resp = await client.post(
File "E:\GradioThing\venv\lib\site-packages\httpx\_client.py", line 1848, in post
return await self.request(
File "E:\GradioThing\venv\lib\site-packages\httpx\_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "E:\GradioThing\venv\lib\site-packages\httpx\_client.py", line 1617, in send
response = await self._send_handling_auth(
File "E:\GradioThing\venv\lib\site-packages\httpx\_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
File "E:\GradioThing\venv\lib\site-packages\httpx\_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
File "E:\GradioThing\venv\lib\site-packages\httpx\_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
File "E:\GradioThing\venv\lib\site-packages\httpx\_transports\default.py", line 365, in handle_async_request
with map_httpcore_exceptions():
File "D:\Python\lib\contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "E:\GradioThing\venv\lib\site-packages\httpx\_transports\default.py", line 83, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectTimeout