From 33b91c19320b010882d79588b9fcd91d82ca1d02 Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Fri, 8 Jun 2018 17:00:46 +0800 Subject: [PATCH] repo-review: Fix missing imports Bug: None Test: ./repo_review.py -g [gerrit] query -l Code-Review +2 Change-Id: Iafac171193299ec3894f9674df08cbdcc213af8b --- tools/repo_pull/gerrit.py | 6 ++++-- tools/repo_pull/repo_review.py | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/repo_pull/gerrit.py b/tools/repo_pull/gerrit.py index 5cb1b93ce..3bead35ed 100755 --- a/tools/repo_pull/gerrit.py +++ b/tools/repo_pull/gerrit.py @@ -25,9 +25,11 @@ import os import sys try: - from urllib.request import HTTPBasicAuthHandler, build_opener # PY3 + from urllib.request import ( + HTTPBasicAuthHandler, Request, build_opener) # PY3 except ImportError: - from urllib2 import HTTPBasicAuthHandler, build_opener # PY2 + from urllib2 import ( + HTTPBasicAuthHandler, Request, build_opener) # PY2 try: from urllib.parse import urlencode, urlparse # PY3 diff --git a/tools/repo_pull/repo_review.py b/tools/repo_pull/repo_review.py index bae2853f6..e12606d04 100755 --- a/tools/repo_pull/repo_review.py +++ b/tools/repo_pull/repo_review.py @@ -22,6 +22,11 @@ from __future__ import print_function from gerrit import create_url_opener_from_args, query_change_lists, set_review +try: + from urllib.error import HTTPError # PY3 +except ImportError: + from urllib2 import HTTPError # PY2 + import argparse import json import os