From 535da2a53b24e20444b09f89a6055f89784cfce3 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Thu, 19 Apr 2012 15:58:09 +0200 Subject: The new python interface to bugzilla does not handle logging in and out at the lower level; this is now part of the command line interface. As a result, we need to prompt for a username and password and log in ourselves. This will be used in the updated arch testing tools. --- common.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'common.py') diff --git a/common.py b/common.py index ad25ad8..16abf70 100644 --- a/common.py +++ b/common.py @@ -3,6 +3,7 @@ import cStringIO import datetime +import getpass import re import portage @@ -42,6 +43,27 @@ def expand_braces(orig): return list(set(res)) +def get_input(prompt): + return raw_input(prompt) + + +def login(bugzilla): + """Authenticate a session. + """ + # prompt for username + user = get_input('Bugzilla Username: ') + + # prompt for password + password = getpass.getpass() + + # perform login + params = {} + params['login'] = user + params['password'] = password + print 'Logging in' + bugzilla.User.login(params) + + class Bug: def __init__(self, xml=None, id_number=None, summary=None, status=None): if xml is not None: -- cgit v1.2.3-65-gdbad