Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
read=5,
connect=5,
backoff_factor=0.3,
status_forcelist=(500, 502, 504),
)
adapter = HTTPAdapter(max_retries=retry)
self.session.mount("http://", adapter)
self.session.mount("https://", adapter)
if not auth:
try:
auth = HTTPBasicAuthFromNetrc(url)
except ValueError as e:
logger.debug("Error parsing netrc: %s", str(e))
pass
elif isinstance(auth, Anonymous):
logger.debug("Anonymous")
auth = None
if auth:
if not isinstance(auth, requests.auth.AuthBase):
raise ValueError(
"Invalid auth type; must be derived from requests.auth.AuthBase"
)
if not self.url.endswith(GERRIT_AUTH_SUFFIX):
self.url += GERRIT_AUTH_SUFFIX
else:
if self.url.endswith(GERRIT_AUTH_SUFFIX):
self.url = self.url[: -len(GERRIT_AUTH_SUFFIX)]
self.kwargs = {"auth": auth, "verify": verify}