Support proxy in request and session cmds (#754)

This commit is contained in:
NyaMisty
2023-05-24 03:53:13 +08:00
committed by GitHub
parent 4db85a2d0f
commit efaa5f31b6
3 changed files with 10 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ class SessionsStorage:
def __init__(self):
self.sessions = {}
def create(self, session_id: Optional[str] = None, force_new: Optional[bool] = False) -> Tuple[Session, bool]:
def create(self, session_id: Optional[str] = None, proxyconf: Optional[dict] = None, force_new: Optional[bool] = False) -> Tuple[Session, bool]:
"""create creates new instance of WebDriver if necessary,
assign defined (or newly generated) session_id to the instance
and returns the session object. If a new session has been created
@@ -44,7 +44,7 @@ class SessionsStorage:
if self.exists(session_id):
return self.sessions[session_id], False
driver = utils.get_webdriver()
driver = utils.get_webdriver(proxyconf=proxyconf)
created_at = datetime.now()
session = Session(session_id, driver, created_at)