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

Proxy Session not working with subsequent python request after FlareSolverr initialization #1100

Open
4 tasks done
jacobprice808 opened this issue Feb 27, 2024 · 1 comment
Labels
help wanted Extra attention is needed needs investigation

Comments

@jacobprice808
Copy link

jacobprice808 commented Feb 27, 2024

Have you checked our README?

  • I have checked the README

Have you followed our Troubleshooting?

  • I have followed your Troubleshooting

Is there already an issue for your problem?

  • I have checked older issues, open and closed

Have you checked the discussions?

  • I have read the Discussions

Environment

- FlareSolverr version: 3.3.15
- Last working FlareSolverr version: v3.3.14 hotfix 2
- Operating system: OSX
- Are you using Docker: No
- FlareSolverr User-Agent (see log traces or / endpoint): "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
- Are you using a VPN: No
- Are you using a Proxy: Yes
- Are you using Captcha Solver: No
- If using captcha solver, which one:
- URL to test this issue:
https://app.prizepicks.com/

Description

In v3.3.14 hotfix 2, I would do the following:

import requests

response = requests.post(http://localhost:8191/v1, headers=self.headers, json=data)
response_data = json.loads(response.content)
original_cookies = response_data["solution"]["cookies"]
cookies = {cookie["name"]: cookie["value"] for cookie in original_cookies}
user_agent = response_data["solution"]["userAgent"]

self.proxies[index].session = requests.Session()
self.proxies[index].session.headers.update({"User-Agent": user_agent})
self.proxies[index].session.cookies.update(cookies)
response = self.proxies[index].session.get('https://api.prizepicks.com/projections?league_id=35&per_page=10&single_stat=true', proxies=proxies_dict, timeout=self.timeout)

As long as I got the cookies and user agent, the subsequent requests would work until cf_bm_cookie expires. After updating to 3.3.15, the subsequent request fails with status code 403 or a timeout error, despite the session object appearing the same as in v3.3.14 hotfix, which is working fine (besides #1036). I am wondering if CF is is internally flagging the cookie as tainted on their end or something when they see dev tools open.

Logged Error Messages

2024-02-26 23:43:24 INFO     Incoming request => POST /v1 body: {'cmd': 'request.get', 'url': 'https://app.prizepicks.com/', 'maxTimeout': 15000, 'proxy': {'url': 'http://proxy_ip:proxy_port', 'username': 'admin', 'password': 'Password'}}
2024-02-26 23:43:38 INFO     Challenge not detected!
2024-02-26 23:43:38 INFO     Response in 13.985 s
2024-02-26 23:43:38 INFO     127.0.0.1 POST http://localhost:8191/v1 200 OK
2024-02-26 23:43:38 WARNING  unhandled incoming priority event

Screenshots

No response

@jacobprice808
Copy link
Author

I have been playing around with DrissionPage and it works very well. It's not experiencing the same CF looping issues as Undetected Chromedriver. All of these little patches developer window patches are not permanent/reliable and not fixing the core issue. In some cases, like this, they are causing more issues. I think that this project should pivot to using Drission. The alternative would be for undetected chromedriver to try and adopt the differences that Drission has made for it to work so well. Both are chromium-based, so I can't imagine they are too different. If I figure it out, I will put in a pull request on UC, but I doubt it will get taken promptly since there is a huge PR queue. One downside is that it doesn't natively support proxy with auth, but I made some modifications using this library and got it working reliability. If you guys aren't ready for a big change like that, I'll probably just fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed needs investigation
Projects
None yet
Development

No branches or pull requests

2 participants