hentai-chan / hentai

Implements a wrapper class around nhentai's RESTful API.
https://www.hentai-chan.dev/projects/hentai
GNU General Public License v3.0
210 stars 21 forks source link

[ BUG ] Error while trying to interact with the wrapper/api #157

Closed TheLLaw closed 2 years ago

TheLLaw commented 2 years ago

Describe the Bug

I'm using version 3.2.10 and get an error while trying to interact with the api in any form.


Steps To Reproduce

Any interaction is failing which makes me think it's an API change or something.

`from hentai import Hentai as H

print(H(177013))`

System Information

OS Name Python Version App Version
Windows 3.10.2 3.2.10

Error message & warnings

Traceback (most recent call last):
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 440, in send
    resp = conn.urlopen(
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 876, in urlopen
    return self.urlopen(
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 876, in urlopen
    return self.urlopen(
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 876, in urlopen
    return self.urlopen(
  [Previous line repeated 2 more times]
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 866, in urlopen
    retries = retries.increment(method, url, response=response, _pool=self)
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='nhentai.net', port=443): Max retries exceeded with url: /api/gallery/177013 (Caused by ResponseError('too many 503 error responses'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Projects\discordbot\test.py", line 3, in <module>
    print(H(177013))
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\hentai\hentai.py", line 531, in __init__
    self.__response = self.handler.get(self.api)
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\hentai\hentai.py", line 479, in get
    response = self.session.get(url, timeout=self.timeout, proxies=self.proxies or getproxies(), **kwargs)
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 542, in get
    return self.request('GET', url, **kwargs)
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\imagi\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 510, in send
    raise RetryError(e, request=request)
requests.exceptions.RetryError: HTTPSConnectionPool(host='nhentai.net', port=443): Max retries exceeded with url: /api/gallery/177013 (Caused by ResponseError('too many 503 error responses'))```

### Code samples

```cli
from hentai import Hentai as H

print(H(177013))

Expected behavior

I'm expecting it to return a Hentai object.