当前位置: 首页>>代码示例>>Python>>正文


Python RBClient.login方法代码示例

本文整理汇总了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
开发者ID:prongs,项目名称:apache-dev-tool,代码行数:29,代码来源:clients.py

示例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
开发者ID:rajubairishetti,项目名称:apache-dev-tool,代码行数:28,代码来源:clients.py

示例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
开发者ID:yssharma,项目名称:rbt-jira,代码行数:22,代码来源:clients.py

示例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
开发者ID:shaunduncan,项目名称:helga-reviews,代码行数:38,代码来源:helga_reviews.py


注:本文中的rbtools.api.client.RBClient.login方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。