Code Monkey home page Code Monkey logo

Comments (12)

v1k45 avatar v1k45 commented on May 23, 2024

from python-qbittorrent.

dacabdi avatar dacabdi commented on May 23, 2024

1. No.

It would clear out CP as the possible culprit. But sincerely, it looks to me that the problem is in the API. CP is sending you the same keys regardless of how many torrents there are active, yet, the error is produced only with a great deal of them (it seems to me). Also, their log is giving me the error traceback to your methods.

I know it is a pity, but I have never worked with python and I understand very little of its ecosystem. I did understand that you are giving out a class with a method that takes a set of keys and values that you use to build your HTTP request and forward it to the WebUI. It filters through the torrents and has a callback waiting. It seems to me that on their side they are just sending the label. They pull that from the configuration variables or in its defect, from the default "couchpotato" label.

I read a little through your code thinking naively that it could be that qBittorrent is expecting a "category" key and CP was calling it "label", but it seems to me that your own API is aware of that problem and corrects it before submitting.

2. Yes.

The Web UI is up. Also, it receives with no problem the requests to add torrents.

Note: Another issue that I don't know if is in your side or CP's, but I feel it's ok to give the heads up, the torrents are not getting deleted upon completion.

from python-qbittorrent.

v1k45 avatar v1k45 commented on May 23, 2024

I did understand that you are giving out a class with a method that takes a set of keys and values that you use to build your HTTP request and forward it to the WebUI.

Yes, this library just provides a python API on top of the WEB API provided by qBittorrent

I read a little through your code thinking naively that it could be that qBittorrent is expecting a "category" key and CP was calling it "label", but it seems to me that your own API is aware of that problem and corrects it before submitting.

Yes, qBittorrent recently changed the label key to category key without any deprecation warnings and the change is not consistent, some endpoints work with the label key and some with the category key.

CP maintains its own version of this lib on its repository here. And they updated it long ago. This is why I asked if you are able to view the torrents with this library alone, I am not trying to blame anyone here :)

I never used this lib with more than 30 active torrents running on qBittorrent and reproducing this bug will require me to add at least 500 torrents in my client and it would take good amount of time. It would be very helpful if you try can see reproduce this using the library alone. You can read the docs, you should be able to set it up and test it within 10-15 minutes.

from python-qbittorrent.

dacabdi avatar dacabdi commented on May 23, 2024

Yes, I checked CP's version of your API and noticed that they even have it with a different class name. And also I pondered the fact that you probably have no way of testing this problem. Since I have never worked with python, I'll do this: I will wait until the torrents are downloaded fully, they should in less than a week. Keep trying from CP's interface, and see if the problem disappears with a lower amount of torrents.

If not, It could maybe be a good reason to take my first baby steps into python. Thanks anyways. I will come back and keep you posted in any case.

from python-qbittorrent.

dacabdi avatar dacabdi commented on May 23, 2024

Anyways... I'm gonna drop this here in case you want to look at it: https://couchpota.to/forum/viewtopic.php?f=3&t=51392&p=79451#p79451

from python-qbittorrent.

v1k45 avatar v1k45 commented on May 23, 2024

I replied to that thread so that we can investigate further.

If you want to test if you can reproduce this issue, you can follow the following steps:

  1. Create a file named qbtest.py with the following code:
from qbittorrent import Client

qb = Client('http://127.0.0.1:8080/')

qb.login('admin', 'your-secret-password')
# defaults to admin:admin.
# to use defaults, just do qb.login()

torrents = qb.torrents()
print len(torrents)
  1. Run the following commands on your terminal
$ sudo apt-get install python-pip
$ sudo pip install python-qbittorrent
$ python qbtest.py

This should print the number of torrents you have running in you client. Let me know what output you see.

from python-qbittorrent.

dacabdi avatar dacabdi commented on May 23, 2024

This is my output, as you see, it fails intermittently.

sysadmin@slavesrv:/$ python ~/qbtest.py
540
sysadmin@slavesrv:/$ python ~/qbtest.py
540
sysadmin@slavesrv:/$ python ~/qbtest.py
Traceback (most recent call last):
  File "/home/sysadmin/qbtest.py", line 9, in <module>
    torrents = qb.torrents()
  File "/usr/local/lib/python2.7/dist-packages/qbittorrent/client.py", line 169, in torrents
    return self._get('query/torrents', params=params)
  File "/usr/local/lib/python2.7/dist-packages/qbittorrent/client.py", line 44, in _get
    return self._request(endpoint, 'get', **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/qbittorrent/client.py", line 76, in _request
    request = rq.get(final_url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 473, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))
sysadmin@slavesrv:/$ python ~/qbtest.py
540
sysadmin@slavesrv:/$ python ~/qbtest.py
540
sysadmin@slavesrv:/$ python ~/qbtest.py
540
sysadmin@slavesrv:/$ python ~/qbtest.py
540
sysadmin@slavesrv:/$ python ~/qbtest.py
^[[ATraceback (most recent call last):
  File "/home/sysadmin/qbtest.py", line 9, in <module>
    torrents = qb.torrents()
  File "/usr/local/lib/python2.7/dist-packages/qbittorrent/client.py", line 169, in torrents
    return self._get('query/torrents', params=params)
  File "/usr/local/lib/python2.7/dist-packages/qbittorrent/client.py", line 44, in _get
    return self._request(endpoint, 'get', **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/qbittorrent/client.py", line 76, in _request
    request = rq.get(final_url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 473, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))

sysadmin@slavesrv:/$ python ~/qbtest.py
540

from python-qbittorrent.

dacabdi avatar dacabdi commented on May 23, 2024

Look, I have the frontend of qBittorrent accesible from outside. If you need to run testing and you want to have a proper scenario with +500 torrents, I'm willing to have setup some temporary password and give you access. Then you can query it from outside. Let me know if that is OK with you. I can even bring it up to a +1000 torrents if you want a more intense setup.

from python-qbittorrent.

v1k45 avatar v1k45 commented on May 23, 2024

Okay, I tried to lookup the cause of this problem and found this. This error is raised when the connection is reset/closed by the client itself.

You can setup a temporary account for me and email me the credentials if you comfortable with it. I'll try to test it by this sunday.

from python-qbittorrent.

dacabdi avatar dacabdi commented on May 23, 2024

Will do. Funny enough, this would probably signal something to you, I changed the url that CP is using to query qB to the outside name that I have, and it is working fine now. Also tested it with your snippet, and it works. Some timing issue? No clue.

from python-qbittorrent.

v1k45 avatar v1k45 commented on May 23, 2024

If changing the local URL to a public URL fixes the problem then I don't think I'll be able to reproduce the issue unless I do the same setup on my local machine (i.e. adding more than 500 torrents).

I'll keep this issue open for few weeks and if everything goes okay, I'll assume that it was an issue related to python itself. And the workaround/fix towards it is using public url instead of local url.

from python-qbittorrent.

github-actions avatar github-actions commented on May 23, 2024

Stale issue message

from python-qbittorrent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.