Commit 8e5e3151 authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Tim Gardner

UBUNTU: [Debian] git-ubuntu-log -- handle invalid or private bugs

Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
parent 5f77b0f4
......@@ -64,18 +64,22 @@ for bug in bugs:
else:
bug_info = None
#urllib.request.urlcleanup()
request = urllib.request.Request('https://api.launchpad.net/devel/bugs/' + bug)
request.add_header('Cache-Control', 'max-age=0')
with urllib.request.urlopen(request) as response:
data = response.read()
bug_info = json.loads(data.decode('utf-8'))
title = bug_info['title']
if 'description' in bug_info:
for line in bug_info['description'].split('\n'):
if line.startswith('Kernel-Description:'):
title = line.split(' ', 1)[1]
try:
#urllib.request.urlcleanup()
request = urllib.request.Request('https://api.launchpad.net/devel/bugs/' + bug)
request.add_header('Cache-Control', 'max-age=0')
with urllib.request.urlopen(request) as response:
data = response.read()
bug_info = json.loads(data.decode('utf-8'))
title = bug_info['title']
if 'description' in bug_info:
for line in bug_info['description'].split('\n'):
if line.startswith('Kernel-Description:'):
title = line.split(' ', 1)[1]
except urllib.error.HTTPError:
title = 'INVALID or PRIVATE BUG'
title += ' (LP: #' + bug + ')'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment