nomnoms12 / saucenao_api

Wrapper for SauceNAO JSON API
https://pypi.org/project/saucenao-api
GNU General Public License v3.0
64 stars 14 forks source link

saucenao_api.errors.UnknownClientError: Unknown client error, status < 0 #18

Open heitumo opened 2 years ago

heitumo commented 2 years ago
  File "/Users/x/dev/pysaucenaonao/ex.py", line 9, in main
    results = await aio.from_file('/users/x/desktop/p0583.jpg')
  File "/usr/local/lib/python3.10/site-packages/saucenao_api/saucenao_api.py", line 125, in from_file
    return await self._search(self.params, {'file': file})
  File "/usr/local/lib/python3.10/site-packages/saucenao_api/saucenao_api.py", line 144, in _search
    raw = self._verify_response(parsed_resp, params)
  File "/usr/local/lib/python3.10/site-packages/saucenao_api/saucenao_api.py", line 173, in _verify_response
    raise UnknownClientError('Unknown client error, status < 0')
saucenao_api.errors.UnknownClientError: Unknown client error, status < 0

with code below:

import asyncio
from saucenao_api import AIOSauceNao

async def main():
    # async requesting is also supported via the AIOSauceNao class
    async with AIOSauceNao('API code get from offical site') as aio:
        #results = sauce.from_url('https://i.imgur.com/oZjCxGo.jpg')  # or from_file()
        #results = await aio.from_url('https://i.imgur.com/oZjCxGo.jpg')
        results = await aio.from_file('/users/x/desktop/p0583.jpg')
        best = results[0]
        print(results)

asyncio.run(main())

But from_url is ok. got such result:

pysaucenaonao % python3 ex.py <SauceResponse(count=6, long_remaining=83, short_remaining=3)>

where changed

  #results = await aio.from_url('https://i.imgur.com/oZjCxGo.jpg')
        results = await aio.from_file('/users/x/desktop/p0583.jpg')

to

    results = await aio.from_url('https://i.imgur.com/oZjCxGo.jpg')
     #   results = await aio.from_file('/users/x/desktop/p0583.jpg')

Thank you.

DewasSquid commented 1 year ago

I made a pull request that fixed this bug

nomnoms12 commented 1 year ago

@DewasSquid Hi! Thank you for your attention.

I'm very busy and can't make time for it right now 😔. But I will try to look into the bug and see your PR early next week

Isaias-F commented 1 year ago

There is a new PR, it would be great if you can review it. @nomnoms12