From adcf5dd94052481f66deaf402ac4ace1ffc06f49 Mon Sep 17 00:00:00 2001 From: Allen Wittenauer Date: Mon, 20 Jul 2015 09:47:46 -0700 Subject: [PATCH] HADOOP-12237. releasedocmaker.py doesn't work behind a proxy (Tsuyoshi Ozawa via aw) (cherry picked from commit b41fe3111ae37478cbace2a07e6ac35a676ef978) --- dev-support/releasedocmaker.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dev-support/releasedocmaker.py b/dev-support/releasedocmaker.py index 409d8e3825..d2e5dda964 100755 --- a/dev-support/releasedocmaker.py +++ b/dev-support/releasedocmaker.py @@ -24,6 +24,7 @@ import re import sys import urllib +import urllib2 try: import json except ImportError: @@ -125,7 +126,7 @@ def __init__(self,versions, projects): versions.sort() print "Looking for %s through %s"%(versions[0],versions[-1]) for p in projects: - resp = urllib.urlopen("https://issues.apache.org/jira/rest/api/2/project/%s/versions"%p) + resp = urllib2.urlopen("https://issues.apache.org/jira/rest/api/2/project/%s/versions"%p) data = json.loads(resp.read()) for d in data: if d['name'][0].isdigit and versions[0] <= d['name'] and d['name'] <= versions[-1]: @@ -288,7 +289,7 @@ def __init__(self, version, projects): self.projects = projects v=str(version).replace("-SNAPSHOT","") - resp = urllib.urlopen("https://issues.apache.org/jira/rest/api/2/field") + resp = urllib2.urlopen("https://issues.apache.org/jira/rest/api/2/field") data = json.loads(resp.read()) self.fieldIdMap = {} @@ -301,7 +302,7 @@ def __init__(self, version, projects): count=100 while (at < end): params = urllib.urlencode({'jql': "project in ('"+"' , '".join(projects)+"') and fixVersion in ('"+v+"') and resolution = Fixed", 'startAt':at, 'maxResults':count}) - resp = urllib.urlopen("https://issues.apache.org/jira/rest/api/2/search?%s"%params) + resp = urllib2.urlopen("https://issues.apache.org/jira/rest/api/2/search?%s"%params) data = json.loads(resp.read()) if (data.has_key('errorMessages')): raise Exception(data['errorMessages']) @@ -407,6 +408,10 @@ def main(): if (len(options.versions) <= 0): parser.error("At least one version needs to be supplied") + proxy = urllib2.ProxyHandler() + opener = urllib2.build_opener(proxy) + urllib2.install_opener(opener) + projects = options.projects if (options.range is True):