def testPOSTOpenRedirect(url: str, cookies: Mapping[str, str], data: Mapping[str, str]) -> Optional[str]:
""" If the given URL redirects when accessed with the given cookies via POST, return the new URL, otherwise
return None """
driver = SeleniumDrivers.getFirefoxDriver()
driver.setCookies(url, cookies)
try:
driver.post(url, data)
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
评论列表
文章目录