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

websockets 14.1 produces error #143

Open
tjalb opened this issue Nov 20, 2024 · 2 comments
Open

websockets 14.1 produces error #143

tjalb opened this issue Nov 20, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@tjalb
Copy link

tjalb commented Nov 20, 2024

Description of the bug
When running pytr dl_docs ./ it ends with BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'. This is caused by a change in the "websockets" package version 14.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the TradeRepublic document folder
  2. Ran the command pytr dl_docs ./
  3. Enter the code from the TR-App'
  4. See error

Expected behavior
pytr downloads the documents.

Error log

File "/opt/homebrew/bin/pytr", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pytr/main.py", line 266, in main
    asyncio.get_event_loop().run_until_complete(dl.dl_loop())
  File "/opt/homebrew/Cellar/[email protected]/3.11.10/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pytr/dl.py", line 68, in dl_loop
    await self.tl.get_next_timeline_transactions()
  File "/opt/homebrew/lib/python3.11/site-packages/pytr/timeline.py", line 30, in get_next_timeline_transactions
    await self.tr.timeline_transactions()
  File "/opt/homebrew/lib/python3.11/site-packages/pytr/api.py", line 506, in timeline_transactions
    return await self.subscribe({"type": "timelineTransactions", "after": after})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pytr/api.py", line 322, in subscribe
    ws = await self._get_ws()
         ^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pytr/api.py", line 301, in _get_ws
    self._ws = await websockets.connect(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/websockets/asyncio/client.py", line 442, in __await_impl__
    self.connection = await self.create_connection()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/websockets/asyncio/client.py", line 368, in create_connection
    _, connection = await loop.create_connection(factory, **kwargs)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'

Environment

  • OS: MacOS 13.7.1
  • pytr version: 0.3.1

Additional context
Temporary solution: Roll back to websockets V13: pip install websockets==13.

@tjalb tjalb added the bug Something isn't working label Nov 20, 2024
@fred777
Copy link

fred777 commented Nov 20, 2024

Confirmed!

Pipx-Workaround:

pipx inject --force pytr  websockets==13

@ArthurMTX
Copy link

I also encountered that bug and the workaround sent by @fred777 fixed my issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants