mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2025-06-08 04:25:25 +00:00
old request param userAgent returned
This commit is contained in:
parent
08c3766a1b
commit
85deae7bc7
@ -185,6 +185,7 @@ session. When you no longer need to use a session you should make sure to close
|
||||
| session | Optional. Will send the request from and existing browser instance. If one is not sent it will create a temporary instance that will be destroyed immediately after the request is completed. |
|
||||
| session_ttl_minutes | Optional. FlareSolverr will automatically rotate expired sessions based on the TTL provided in minutes. |
|
||||
| maxTimeout | Optional, default value 60000. Max timeout to solve the challenge in milliseconds. |
|
||||
| userAgent | Optional. Used for the current request and does not affect subsequent ones. |
|
||||
| cookies | Optional. Will be used by the headless browser. Eg: `"cookies": [{"name": "cookie1", "value": "value1"}, {"name": "cookie2", "value": "value2"}]`. |
|
||||
| returnOnlyCookies | Optional, default false. Only returns the cookies. Response data, headers and other parts of the response are removed. |
|
||||
| proxy | Optional, default disabled. Eg: `"proxy": {"url": "http://127.0.0.1:8888"}`. You must include the proxy schema in the URL: `http://`, `socks4://` or `socks5://`. Authorization (username/password) is supported. (When the `session` parameter is set, the proxy is ignored; a session specific proxy can be set in `sessions.create`.) |
|
||||
|
@ -35,7 +35,7 @@ class V1RequestBase(object):
|
||||
session: str = None
|
||||
session_ttl_minutes: int = None
|
||||
headers: list = None # deprecated v2.0.0, not used
|
||||
userAgent: str = None # deprecated v2.0.0, not used
|
||||
userAgent: str = None
|
||||
|
||||
# V1Request
|
||||
url: str = None
|
||||
|
@ -295,6 +295,9 @@ def _evil_logic(req: V1RequestBase, driver: ChromiumPage, method: str) -> Challe
|
||||
res.status = STATUS_OK
|
||||
res.message = ""
|
||||
|
||||
old_user_agent = utils.get_user_agent(driver)
|
||||
if req.userAgent is not None and req.userAgent != "":
|
||||
driver.set.user_agent(ua=req.userAgent)
|
||||
|
||||
# navigate to the page
|
||||
logging.debug('Navigating to... %s', req.url)
|
||||
@ -370,7 +373,10 @@ def _evil_logic(req: V1RequestBase, driver: ChromiumPage, method: str) -> Challe
|
||||
challenge_res.headers = data.response.headers.copy()
|
||||
|
||||
challenge_res.cookies = driver.cookies()
|
||||
challenge_res.userAgent = utils.get_user_agent(driver)
|
||||
challenge_res.userAgent = req.userAgent or utils.get_user_agent(driver)
|
||||
|
||||
if old_user_agent:
|
||||
driver.set.user_agent(ua=old_user_agent)
|
||||
|
||||
res.result = challenge_res
|
||||
return res
|
||||
|
Loading…
x
Reference in New Issue
Block a user