本文整理汇总了Python中rbtools.api.client.RBClient.login方法的典型用法代码示例。如果您正苦于以下问题:Python RBClient.login方法的具体用法?Python RBClient.login怎么用?Python RBClient.login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rbtools.api.client.RBClient
的用法示例。
在下文中一共展示了RBClient.login方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rb_client
# 需要导入模块: from rbtools.api.client import RBClient [as 别名]
# 或者: from rbtools.api.client.RBClient import login [as 别名]
def rb_client(self):
options = {}
if os.path.exists(".reviewboardrc"):
with open(".reviewboardrc") as reviewboardrc:
for line in reviewboardrc:
if line.startswith("#"):
continue
if len(line.strip()) == 0:
continue
k, v = line.strip().split("=")
k = k.strip()
v = eval(v.strip())
options[k] = v
rbclient = RBClient(options.get('REVIEWBOARD_URL') or 'https://reviews.apache.org/', RetryingSyncTransport)
if not rbclient.get_root().get_session()['authenticated']:
username = self.opt.reviewboard_username[0] if self.opt.reviewboard_username and \
self.opt.reviewboard_username[0] else raw_input(
"Enter review board Username: ")
password = self.opt.reviewboard_password or getpass("Enter password for %s: " % username)
rbclient.login(username, password)
root = rbclient.get_root()
root.repository = options.get('REPOSITORY') or None
root.branch = options.get('BRANCH') or options.get('TRACKING_BRANCH')
root.target_groups = None
if options.has_key('TARGET_GROUPS'):
root.target_groups = options['TARGET_GROUPS']
return root
示例2: get_rb_client
# 需要导入模块: from rbtools.api.client import RBClient [as 别名]
# 或者: from rbtools.api.client.RBClient import login [as 别名]
def get_rb_client(self):
if not self.rb_client:
options = {}
with open(".reviewboardrc") as reviewboardrc:
for line in reviewboardrc:
if line.startswith("#"):
continue
if len(line.strip()) == 0:
continue
k, v = line.strip().split("=")
k = k.strip()
v = eval(v.strip())
options[k] = v
rbclient = RBClient(options['REVIEWBOARD_URL'])
self.repository = options['REPOSITORY']
self.branch = options.get('BRANCH') or options.get('TRACKING_BRANCH')
self.target_groups = None
if options.has_key('TARGET_GROUPS'):
self.target_groups = options['TARGET_GROUPS']
if rbclient.get_root().get_session()['authenticated']:
return rbclient.get_root()
username = self.opt.reviewboard_username or raw_input("Enter review board Username: ")
password = self.opt.reviewboard_password or getpass("Enter password: ")
rbclient.login(username, password)
self.rb_client = rbclient.get_root()
return self.rb_client
示例3: get_rb_client
# 需要导入模块: from rbtools.api.client import RBClient [as 别名]
# 或者: from rbtools.api.client.RBClient import login [as 别名]
def get_rb_client(self):
options = {}
with open(".reviewboardrc") as reviewboardrc:
for line in reviewboardrc:
k, v = line.split("=")
k = k.strip()
v = eval(v.strip())
options[k] = v
rbclient = RBClient(options['REVIEWBOARD_URL'])
self.repository = options['REPOSITORY']
self.branch = options['BRANCH']
self.target_groups = None
if options.has_key('TARGET_GROUPS'):
self.target_groups = options['TARGET_GROUPS']
if rbclient.get_root().get_session()['authenticated']:
return rbclient
username = raw_input("Enter review board Username: ")
password = getpass("Enter password: ")
rbclient.login(username, password)
return rbclient
示例4: get_open_reviews
# 需要导入模块: from rbtools.api.client import RBClient [as 别名]
# 或者: from rbtools.api.client.RBClient import login [as 别名]
def get_open_reviews(args):
"""
get open reviews to a specified user, group, etc.
"""
args['status'] = 'pending'
if 'max_results' not in args:
args['max_results'] = 100
client = RBClient(REVIEWBOARD_URL)
# If we have a username and password, login
if REVIEWBOARD_USERNAME and REVIEWBOARD_PASSWORD:
client.login(REVIEWBOARD_USERNAME, REVIEWBOARD_PASSWORD)
root = client.get_root()
if not root:
logger.error(u'Could not get RBClient root')
return None
try:
req = root.get_review_requests(**args)
except APIError:
logger.exception(u'Error querying API')
return None
ret = {'total': req.total_results, 'reviews': []}
review_fmt = u"[{user}] {summary} ({url}/r/{id})"
for review in req:
ret['reviews'].append(review_fmt.format(user=review.get_submitter().username,
summary=review.summary,
url=REVIEWBOARD_URL,
id=review.id))
return ret