Closed djtech-dev closed 4 months ago
403 error is issue with authentication/permission, so I don't think it is related to Python version or the requests library. Perhaps you can ask questions on Stack Overflow on why you're getting 403 error
As @Mariatta correctly noted, the response behavior from the service isn't something we control. There are a number of reasons you may be receiving a different status code depending on Python version, both from your environment and potential service-side decisions based on client fingerprinting.
StackOverflow is the best place to ask these questions unless you're able to provide a reproducible example without the service in question.
The investpy library doesn't work under CPython 3.11 while it works without issues with CPython 3.10
Expected Result
In the search.py file, at line 157 (function
search_quotes
), I get a ConnectionError (not raised by requests, but connected to the status_code returned by requests). This error is weirdly only raised on Python 3.11, while Python 3.10 works without issue. I've edited the code in order to print some important informations (the parameters and the output for the requests's POST function).Snippet (original, can be found at the link before):
Snippet (modified, added print statements and a static user agent, while the original project generated each time a new user agent in order to fake activity):
Result on CPython 3.10:
Actual Result
Results on CPython 3.11:
Reproduction Steps
Use the snippet/library showed before.
System Information
Running under CPython 3.10:
Running under CPython 3.11: