def _check_for_redirect(self, url: str, req: http.client.HTTPResponse): response_url = req.geturl() if url != response_url: new_owner, new_name = (urllib.parse.urlsplit( response_url).path.strip("/").split("/")[:2]) new_repo = RepoGitHub(owner=new_owner, repo=new_name, branch=self.branch) self.redirect = new_repo
def _check_for_redirect(self, url: str, req: http.client.HTTPResponse): response_url = req.geturl() if url != response_url: new_owner, new_name = (urllib.parse.urlsplit( response_url).path.strip("/").split("/")[:2]) end_line = "\n" if self.alias is None else f" as {self.alias}\n" plugin_line = "{owner}/{name}" + end_line old_plugin = plugin_line.format(owner=self.owner, name=self.name) new_plugin = plugin_line.format(owner=new_owner, name=new_name) self.redirect[old_plugin] = new_plugin