diff --git a/advisors/gitee.py b/advisors/gitee.py index 14dab42808cde41e35ca9ee9060a9a85a1bb5dcc..75e771b3509c03665495139d2a2aa6253a86f1d3 100755 --- a/advisors/gitee.py +++ b/advisors/gitee.py @@ -164,14 +164,21 @@ class Gitee(): """ GET from gitee api """ + if '?' in url: + new_url = url + "&" + else: + new_url = url + "?" + new_url = new_url + "access_token=" + self.token["access_token"] if headers is None: - req = urllib.request.Request(url=url, headers=self.headers) + req = urllib.request.Request(url=new_url, headers=self.headers) else: - req = urllib.request.Request(url=url, headers=headers) + req = urllib.request.Request(url=new_url, headers=headers) try: result = urllib.request.urlopen(req) return result.read().decode("utf-8") - except urllib.error.HTTPError: + except urllib.error.HTTPError as error: + print("get_gitee failed to access: %s" % (url)) + print("get_gitee failed: %d, %s" % (error.code, error.reason)) return None def get_pr(self, repo, num, owner="src-openeuler"): diff --git a/advisors/review_tool.py b/advisors/review_tool.py index cea2a251fbb662c27238a72b3ba6b6a1addc4ea1..5d049c9773586fc74a8cdf926f8a65cf4f3d20c3 100755 --- a/advisors/review_tool.py +++ b/advisors/review_tool.py @@ -662,8 +662,8 @@ def main(): user_gitee = gitee.Gitee() pull_request = user_gitee.get_pr(repo_name, pull_id, group) if not pull_request: - print("Failed to get PR:%s of repository:%s, make sure the PR is exist."\ - % (pull_id, repo_name)) + print("Failed to get PR:%s of repository:%s/%s, make sure the PR is exist."\ + % (pull_id, group, repo_name)) sys.exit(1) if args.edit and args.status: edit_review_status(args, user_gitee, group, repo_name, pull_id)