python-qBittorrent icon indicating copy to clipboard operation
python-qBittorrent copied to clipboard

API calls fails unless referrer is provided

Open kryksyh opened this issue 8 years ago • 6 comments

Hi! I am trying to use this module, but it doesn't work with qBittorrent 3.3.13 on Archlinux x64. All API calls fails unless I specify referrer like this:

        self.session = requests.Session()
        header = {
            'Referer': 'http://localhost:8080'
        }
        login = self.session.post(self.url+'login',
                                  data={'username': username,
                                        'password': password},
                                  headers=header)
        if login.text == 'Ok.':
            self._is_authenticated = True
        else:
            return login.text

I have no experience with qBittorrent, is it my misconfiguration or is it some API update and should be fixed in this library?

python: 3.6.0 requests: 2.18.1

kryksyh avatar Jul 17 '17 20:07 kryksyh

Sorry for the late reply. I'll try to reproduce this and let you know.

v1k45 avatar Jul 19 '17 18:07 v1k45

Hey, I am not able to reproduce this issue. The module works fine without the Referer header.

What do you mean when you say "failed"? What error message are you receiving?

v1k45 avatar Aug 19 '17 07:08 v1k45

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-Documentation#changes

Note that as of API14, referrer is required on all API calls. (qBittorrent 3.20+)

teejo75 avatar May 12 '18 04:05 teejo75

Thanks @teejo75 I'll push a fix for his ASAP.

v1k45 avatar May 30 '18 12:05 v1k45

Did this ever get fixed?

kmlucy avatar Jan 02 '19 22:01 kmlucy

@kmlucy It works fine for me with qb4.1.4, so presumably yes.

the-white-light avatar Jan 04 '19 23:01 the-white-light

Stale issue message

github-actions[bot] avatar Oct 21 '23 21:10 github-actions[bot]