Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type hint in '_http_manager.py' causing TypeError: 'type' object is not subscriptable #259

Open
LeeFuuChang opened this issue Dec 4, 2024 · 0 comments

Comments

@LeeFuuChang
Copy link

Minium code to replicate the error

from pybit.unified_trading import HTTP

Traceback

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    from pybit.unified_trading import HTTP
  File "...\env\lib\site-packages\pybit\unified_trading.py", line 7, in <module>
    from ._v5_misc import MiscHTTP
  File "...\env\lib\site-packages\pybit\_v5_misc.py", line 1, in <module>
    from ._http_manager import _V5HTTPManager
  File "...\env\lib\site-packages\pybit\_http_manager.py", line 62, in <module>
    class _V5HTTPManager:
  File "...\env\lib\site-packages\pybit\_http_manager.py", line 75, in _V5HTTPManager
    retry_codes: defaultdict[dict] = field(
TypeError: 'type' object is not subscriptable

Fixes

'_http_manager.py'

line 1

from collections import defaultdict # old

from typing import DefaultDict, Any # new

line 75

    retry_codes: defaultdict[dict] = field( # old

    retry_codes: DefaultDict[dict, Any] = field( # new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant