How to use the pygerrit2.rest.auth.Anonymous function in pygerrit2

To help you get started, we’ve selected a few pygerrit2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dpursehouse / pygerrit2 / pygerrit2 / rest / __init__.py View on Github external
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}