def insert_auth(self, url: str) -> str: """See :py:meth:`repobee_plug.PlatformAPI.insert_auth`.""" html_base_url = self._org.html_url[: -len(self._org_name) - 1] if html_base_url not in url: raise plug.InvalidURL(f"url not found on platform: '{url}'") auth = "{}:{}".format(self._user, self.token) return url.replace("https://", f"https://{auth}@")
def insert_auth(self, url: str) -> str: """See :py:meth:`repobee_plug.PlatformAPI.insert_auth`.""" scheme, netloc, path, query, fragment = urllib.parse.urlsplit(url) base_scheme, base_netloc, *_ = urllib.parse.urlsplit( self._org.html_url) html_base_url = urllib.parse.urlunsplit( [base_scheme, base_netloc, *([""] * 3)]) if html_base_url not in url: raise plug.InvalidURL(f"url not found on platform: '{url}'") auth = f"{self._user}:{self.token}" return urllib.parse.urlunsplit( [scheme, f"{auth}@{netloc}", path, query, fragment])
def insert_auth(self, url: str) -> str: """See :py:meth:`repobee_plug.PlatformAPI.insert_auth`.""" if f"file://{self._repodir}" not in url: raise plug.InvalidURL(f"url not found on platform: '{url}'") return url
def insert_auth(self, url: str) -> str: """See :py:meth:`repobee_plug.PlatformAPI.insert_auth`.""" if self._base_url not in url: raise plug.InvalidURL("url not found on platform: '{url}'") return self._insert_auth(url)