-
Notifications
You must be signed in to change notification settings - Fork 155
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
Xtream API - Error 403 (Forbidden) if requests sent without user-agent [with solution] #274
Comments
Could you test the Pull Request I have with your xtream account and write a comment if it works for you? |
@superolmo Sorry for my delayed response. |
I found a bug where Hypnotix is unable to authenticate to Xtream API if user-agent is not sent in header request. But as I tried the URL in browser and it worked out of the box, I gave a try looking for the issue - and found it: Xtream API refuses to authenticate if User-Agent is not sent as a request header.
But I found a really easy workaround (not with time now to create a pull request).
In file
xtream.py
, methodauthenticate(self)
, just at the start of try block, add:headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'}
And at the next line (where requests takes place), add a new parameter
headers=headers
.Also in the same
xtream.py
file, in method_get_request(self, URL: str, timeout: Tuple = (2,15))
, add the sameheaders
definition (as described upwards) before the try block and, just after it, in the requests call, add the new parameterheaders=headers
.That should do the trick!
The text was updated successfully, but these errors were encountered: