uJhin / python-upbit-client

Upbit(업비트) Cryptocurrency Exchange OPEN API Client for Python
https://ujhin.github.io/upbit-client-docs
MIT License
48 stars 35 forks source link

Need error handling #39

Closed wollala closed 11 months ago

wollala commented 11 months ago

If we call the "client.APIKey.APIKey_info()" function with incorrect API key, The server doesn't put 'Remaining-Req' in the header. This results in the following error

 File "C:\Users\junpa\Workspace\PycharmProjects\wSplit\ub\service\uCaller.py", line 42, in api_key_test
    resp = client.APIKey.APIKey_info()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\junpa\Workspace\PycharmProjects\wSplit\venv\Lib\site-packages\upbit\models.py", line 78, in APIKey_info
    return HTTPFutureExtractor.future_extraction(future)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\junpa\Workspace\PycharmProjects\wSplit\venv\Lib\site-packages\upbit\utils.py", line 28, in future_extraction
    remaining = HTTPFutureExtractor.remaining_request(resp.headers)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\junpa\Workspace\PycharmProjects\wSplit\venv\Lib\site-packages\upbit\utils.py", line 15, in remaining_request
    remaining = headers['Remaining-Req']
                ~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\junpa\Workspace\PycharmProjects\wSplit\venv\Lib\site-packages\requests\structures.py", line 52, in __getitem__
    return self._store[key.lower()][1]
           ~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'remaining-req'

So, need the error handling in remaining_request() function of "utils.py".

uJhin commented 11 months ago

image

In my case, there was no error. Would you like to check the package version?

uJhin commented 11 months ago

Well, Considering that there are no more comments and answers on the issue, I think it's okay to close it now, so I'll close it.