def testGETOpenRedirect(url: str, cookies: Mapping[str, str]) -> Optional[str]:
""" If the given URL redirects when accessed with the given cookies via GET, return the new URL, otherwise
return None """
driver = SeleniumDrivers.getFirefoxDriver()
driver.setCookies(url, cookies)
try:
driver.get(url)
time.sleep(config.timeout)
if driver.current_url == url:
driver.reset()
return None
else:
url = driver.current_url
driver.reset()
return url
except (TimeoutException, URLError):
driver.reset()
return None
评论列表
文章目录