kitUIN/PicImageSearch

some search engine can not work

Closed this issue · 4 comments

some search engine can not work ,such as google, , yandex.

I don't understand why you say that.
Please provide more detailed information.

First, please check your network environment.
If you need to access Google / Yandex through a proxy, make sure you have configured the proxies param.

I don't understand why you say that. Please provide more detailed information.

First, please check your network environment. If you need to access Google / Yandex through a proxy, make sure you have configured the proxies param.

i use the vpn call connect google.
image
my runner env is python3.11. after open vpn, i test the demo_google
image
**detail information:Traceback (most recent call last):

  File "D:\code\PicImageSearch\demo\cn\demo_google.py", line 64, in <module>
    loop.run_until_complete(test_async())
    │    │                  └ <function test_async at 0x0000021B0F75B060>
    │    └ <function BaseEventLoop.run_until_complete at 0x0000021B0EAAFA60>
    └ <ProactorEventLoop running=True closed=False debug=False>

  File "C:\Users\match\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 640, in run_until_complete
    self.run_forever()
    │    └ <function ProactorEventLoop.run_forever at 0x0000021B0EB87A60>
    └ <ProactorEventLoop running=True closed=False debug=False>
  File "C:\Users\match\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\match\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 607, in run_forever
    self._run_once()
    │    └ <function BaseEventLoop._run_once at 0x0000021B0EAC5800>
    └ <ProactorEventLoop running=True closed=False debug=False>
  File "C:\Users\match\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 1922, in _run_once
    handle._run()
    │      └ <function Handle._run at 0x0000021B0E9FEF20>
    └ <Handle Task.task_wakeup(<Future finished result=None>)>
> File "C:\Users\match\AppData\Local\Programs\Python\Python311\Lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
    │    │            │    │           │    └ <member '_args' of 'Handle' objects>
    │    │            │    │           └ <Handle Task.task_wakeup(<Future finished result=None>)>
    │    │            │    └ <member '_callback' of 'Handle' objects>
    │    │            └ <Handle Task.task_wakeup(<Future finished result=None>)>
    │    └ <member '_context' of 'Handle' objects>
    └ <Handle Task.task_wakeup(<Future finished result=None>)>

  File "D:\code\PicImageSearch\demo\cn\demo_google.py", line 22, in test_async
    resp = await google.search(file=file)
                 │      │           └ '../images/test03.jpg'
                 │      └ <function Google.search at 0x0000021B0F75A200>
                 └ <PicImageSearch.google.Google object at 0x0000021B0F771910>

  File "D:\code\PicImageSearch\PicImageSearch\google.py", line 104, in search
    resp = await self.post(_url, data=params, files=files)
                 │    │    │          │             └ {'encoded_image': b'\xff\xd8\xff\xdb\x00C\x00\x06\x04\x05\x06\x05\x04\x06\x06\x05\x06\x07\x07\x06\x08\n\x10\n\n\t\t\n\x14\x0e...
                 │    │    │          └ {'sbisrc': 1, 'safe': 'off'}
                 │    │    └ 'https://www.google.co.jp/searchbyimage/upload'
                 │    └ <function HandOver.post at 0x0000021B0F75A0C0>
                 └ <PicImageSearch.google.Google object at 0x0000021B0F771910>

  File "D:\code\PicImageSearch\PicImageSearch\network.py", line 232, in post
    resp = await client.post(
                 │      └ <function AsyncClient.post at 0x0000021B0F7432E0>
                 └ <httpx.AsyncClient object at 0x0000021B0F7718D0>

  File "D:\code\PicImageSearch\venv\Lib\site-packages\httpx\_client.py", line 1892, in post
    return await self.request(
                 │    └ <function AsyncClient.request at 0x0000021B0F742CA0>
                 └ <httpx.AsyncClient object at 0x0000021B0F7718D0>
  File "D:\code\PicImageSearch\venv\Lib\site-packages\httpx\_client.py", line 1574, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
                 │    │    │             │                      └ <httpx._client.UseClientDefault object at 0x0000021B0F72FF90>
                 │    │    │             └ <httpx._client.UseClientDefault object at 0x0000021B0F72FF90>
                 │    │    └ <Request('POST', 'https://www.google.co.jp/searchbyimage/upload')>
                 │    └ <function AsyncClient.send at 0x0000021B0F742E80>
                 └ <httpx.AsyncClient object at 0x0000021B0F7718D0>
  File "D:\code\PicImageSearch\venv\Lib\site-packages\httpx\_client.py", line 1661, in send
    response = await self._send_handling_auth(
                     │    └ <function AsyncClient._send_handling_auth at 0x0000021B0F742F20>
                     └ <httpx.AsyncClient object at 0x0000021B0F7718D0>
  File "D:\code\PicImageSearch\venv\Lib\site-packages\httpx\_client.py", line 1689, in _send_handling_auth
    response = await self._send_handling_redirects(
                     │    └ <function AsyncClient._send_handling_redirects at 0x0000021B0F742FC0>
                     └ <httpx.AsyncClient object at 0x0000021B0F7718D0>
  File "D:\code\PicImageSearch\venv\Lib\site-packages\httpx\_client.py", line 1726, in _send_handling_redirects
    response = await self._send_single_request(request)
                     │    │                    └ <Request('POST', 'https://www.google.co.jp/searchbyimage/upload')>
                     │    └ <function AsyncClient._send_single_request at 0x0000021B0F743060>
                     └ <httpx.AsyncClient object at 0x0000021B0F7718D0>
  File "D:\code\PicImageSearch\venv\Lib\site-packages\httpx\_client.py", line 1763, in _send_single_request
    response = await transport.handle_async_request(request)
                     │         │                    └ <Request('POST', 'https://www.google.co.jp/searchbyimage/upload')>
                     │         └ <function AsyncHTTPTransport.handle_async_request at 0x0000021B0F73BF60>
                     └ <httpx.AsyncHTTPTransport object at 0x0000021B0F772490>
  File "D:\code\PicImageSearch\venv\Lib\site-packages\httpx\_transports\default.py", line 372, in handle_async_request
    with map_httpcore_exceptions():
         └ <function map_httpcore_exceptions at 0x0000021B0F59CCC0>
  File "C:\Users\match\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
    │    │   │     │    │      └ <traceback object at 0x0000021B0F7D5380>
    │    │   │     │    └ ConnectError(OSError('All connection attempts failed'))
    │    │   │     └ <class 'httpcore.ConnectError'>
    │    │   └ <method 'throw' of 'generator' objects>
    │    └ <generator object map_httpcore_exceptions at 0x0000021B0F713540>
    └ <contextlib._GeneratorContextManager object at 0x0000021B0F789E50>
  File "D:\code\PicImageSearch\venv\Lib\site-packages\httpx\_transports\default.py", line 86, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
          │          └ 'All connection attempts failed'
          └ <class 'httpx.ConnectError'>

httpx.ConnectError: All connection attempts failed

Process finished with exit code 0**

proxies = "http://127.0.0.1:1080"

Are you sure you have configured the proxies correctly?

proxies = "http://127.0.0.1:1080"

Are you sure you have configured the proxies correctly?

sorry,That is where the problem,i just open vpn,but not change the project proxies config. i use my proxies it can work. tk very much.