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

Exception during response parsing - Failing to connect to Qbittorrent. #2

Closed
swannie-eire opened this issue Feb 8, 2022 · 4 comments

Comments

@swannie-eire
Copy link
Contributor

swannie-eire commented Feb 8, 2022

So currently i am running Qbittorrent 4.3.8 but when I start the seedcross it seems to fail to connect to qbittorrent from the logs.

The credentials im using are correct and i logged into the container and confirmed it can reach qbittorrent on the required port.

these are the logs i am getting from the seedcross container.

2022-02-08T16:19:34.372592391Z json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 468320 (char 468319)
2022-02-08T16:19:34.372604100Z
2022-02-08T16:19:34.372615324Z During handling of the above exception, another exception occurred:
2022-02-08T16:19:34.372626888Z
2022-02-08T16:19:34.372637984Z Traceback (most recent call last):
2022-02-08T16:19:34.372665042Z   File "/usr/local/lib/python3.10/site-packages/background_task/tasks.py", line 43, in bg_runner
2022-02-08T16:19:34.372678361Z     func(*args, **kwargs)
2022-02-08T16:19:34.372689472Z   File "/code/seedcross/crseed/tasks.py", line 80, in backgroundCrossSeedTask
2022-02-08T16:19:34.372700864Z     iterTorrents(dlclient, param, log)
2022-02-08T16:19:34.372711950Z   File "/code/seedcross/crseed/CrossSeedAutoDL.py", line 342, in iterTorrents
2022-02-08T16:19:34.372723419Z     torList = dlclient.loadTorrents()
2022-02-08T16:19:34.372734412Z   File "/code/seedcross/crseed/torclient.py", line 196, in loadTorrents
2022-02-08T16:19:34.372745740Z     torList = self.qbClient.torrents_info()
2022-02-08T16:19:34.372756840Z   File "/usr/local/lib/python3.10/site-packages/qbittorrentapi/decorators.py", line 127, in wrapper
2022-02-08T16:19:34.372769186Z     return f(client, *args, **kwargs)
2022-02-08T16:19:34.372780241Z   File "/usr/local/lib/python3.10/site-packages/qbittorrentapi/decorators.py", line 187, in wrapper
2022-02-08T16:19:34.372791801Z     raise APIError("Exception during response parsing. Error: %s" % repr(e))
2022-02-08T16:19:34.372803443Z qbittorrentapi.exceptions.APIError: Exception during response parsing. Error: JSONDecodeError('Unterminated string starting at: line 1 column 468320 (char 468319)')
2022-02-08T16:19:34.384294652Z Marking task proceed_cross_seed as failed
2022-02-08T16:20:19.112966538Z Rescheduling proceed_cross_seed
2022-02-08T16:20:19.113031774Z Traceback (most recent call last):
2022-02-08T16:20:19.113049637Z   File "/usr/local/lib/python3.10/site-packages/qbittorrentapi/decorators.py", line 178, in wrapper
2022-02-08T16:20:19.113062125Z     result = response.json()
2022-02-08T16:20:19.113073659Z   File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 910, in json
2022-02-08T16:20:19.113085688Z     return complexjson.loads(self.text, **kwargs)
2022-02-08T16:20:19.113097305Z   File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
2022-02-08T16:20:19.113109231Z     return _default_decoder.decode(s)
2022-02-08T16:20:19.113120754Z   File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
2022-02-08T16:20:19.113132688Z     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2022-02-08T16:20:19.113144434Z   File "/usr/local/lib/python3.10/json/decoder.py", line 353, in raw_decode
2022-02-08T16:20:19.113156312Z     obj, end = self.scan_once(s, idx)
2022-02-08T16:20:19.113167786Z json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 225472 (char 225471)
2022-02-08T16:20:19.113179524Z
2022-02-08T16:20:19.113190831Z During handling of the above exception, another exception occurred:
2022-02-08T16:20:19.113202440Z
2022-02-08T16:20:19.113213751Z Traceback (most recent call last):
2022-02-08T16:20:19.113240744Z   File "/usr/local/lib/python3.10/site-packages/background_task/tasks.py", line 43, in bg_runner
2022-02-08T16:20:19.113254740Z     func(*args, **kwargs)
2022-02-08T16:20:19.113265945Z   File "/code/seedcross/crseed/tasks.py", line 80, in backgroundCrossSeedTask
2022-02-08T16:20:19.113277404Z     iterTorrents(dlclient, param, log)
2022-02-08T16:20:19.113288496Z   File "/code/seedcross/crseed/CrossSeedAutoDL.py", line 342, in iterTorrents
2022-02-08T16:20:19.113299914Z     torList = dlclient.loadTorrents()
2022-02-08T16:20:19.113310964Z   File "/code/seedcross/crseed/torclient.py", line 196, in loadTorrents
2022-02-08T16:20:19.113322316Z     torList = self.qbClient.torrents_info()
2022-02-08T16:20:19.113333300Z   File "/usr/local/lib/python3.10/site-packages/qbittorrentapi/decorators.py", line 127, in wrapper
2022-02-08T16:20:19.113344772Z     return f(client, *args, **kwargs)
2022-02-08T16:20:19.113355694Z   File "/usr/local/lib/python3.10/site-packages/qbittorrentapi/decorators.py", line 187, in wrapper
2022-02-08T16:20:19.113367174Z     raise APIError("Exception during response parsing. Error: %s" % repr(e))
2022-02-08T16:20:19.113378762Z qbittorrentapi.exceptions.APIError: Exception during response parsing. Error: JSONDecodeError("Expecting ',' delimiter: line 1 column 225472 (char 225471)")
2022-02-08T16:20:19.131909067Z Marking task proceed_cross_seed as failed

confirmed connection from the container.
Screenshot 2022-02-08 at 16 17 14

Screenshot 2022-02-08 at 16 27 14

@ccf-2012
Copy link
Owner

ccf-2012 commented Feb 9, 2022

It seems a qbittorrentapi.exceptions.APIError, Seedcross use this python package to connect qBittorrent client and retrieve torrent info.
Can you please try the sample code to test your qb 4.3.8 client:

  1. install the lib
pip install qbittorrent-api
  1. edit a testqb.py file like this, modify the host, port, username, password
import qbittorrentapi

qbt_client = qbittorrentapi.Client(
    host='localhost',
    port=8080,
    username='admin',
    password='adminadmin',
)

for torrent in qbt_client.torrents_info():
    print(f'{torrent.hash[-6:]}: {torrent.name} ({torrent.state})')
  1. run the code, and see what happen.
python testqb.py

@swannie-eire
Copy link
Contributor Author

swannie-eire commented Feb 9, 2022

Thanks for the prompt response. That script worked as expected.

Screenshot 2022-02-09 at 19 46 50

I span up another qbittorrent 4.3.8 and seedcross worked as expected for that with the same settings. The only difference between the 2 qbits was the one it does not work with has over 600 torrents in the client and the other has just a handfull.

Any other suggestions?

@ccf-2012
Copy link
Owner

seedcross has reported success for 20k+ torrent in qbittorrent, so maybe some issues to the specific torrent name(blind guess).
I found qbittorrent-api update recently, and supports up to qBittorrent v4.4.0

so I build a new version with all updated libraries and some new functions of dev branch.
Please try the new docker image: https://hub.docker.com/r/ccf2012/seedcross

@swannie-eire
Copy link
Contributor Author

updating to the latest docker image appears to have solved it.

Thank you.

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

2 participants