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


Python TrelloClient.get_member方法代码示例

本文整理汇总了Python中trello.TrelloClient.get_member方法的典型用法代码示例。如果您正苦于以下问题:Python TrelloClient.get_member方法的具体用法?Python TrelloClient.get_member怎么用?Python TrelloClient.get_member使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trello.TrelloClient的用法示例。


在下文中一共展示了TrelloClient.get_member方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from trello import TrelloClient [as 别名]
# 或者: from trello.TrelloClient import get_member [as 别名]
def main():
    usage = '%prog (load|rebuild|commit|push|test|config|update)'\
            ' [options] args... are you ready?'
    
    parser = OptionParser(usage)

    parser.add_option('-i', '--id',
                      type='int',
                      dest='id')

    parser.add_option('-u', '--user',
                      dest='user')

    parser.add_option('-c', '--comment',
                      dest='comment')

    parser.add_option('-g', '--gitpath',
                      default=realpath(__file__), 
                      dest='gitpath')

    parser.add_option('-p', '--params',
                      dest='params')

    parser.add_option('-t', '--title',
                      dest='title')

    parser.add_option('-d', '--description',
                      dest='description',
                      default="")

    (options, args) = parser.parse_args()

    repo = Repo(options.gitpath)
    conf_path = join(expanduser("~"), '.gitr.json')
    
    if not len(args):
        handle_error(msg='Some action are required', handle=parser)

    if not isfile(conf_path):
        conf_src = join(dirname(realpath(__file__)), 'gitr.json')
        shutil.copy(conf_src, conf_path)

    with open(conf_path, 'r') as infile:
        json_data = json.load(infile)

    BOARD_ID = json_data['BOARD_ID']
    CREATE_LIST_ID = json_data['CREATE_LIST_ID']
    DONE_LIST_ID = json_data['DONE_LIST_ID']
    MEMBERS = json_data['MEMBERS']
    USER = MEMBERS[int(json_data['USER'])]

    client = TrelloClient(api_key=json_data['API_KEY'], 
                          token=json_data['TOKEN'], 
                          api_secret=json_data['API_SECRET'])
    
    if ('update' in args):
        create_list = client.get_list(CREATE_LIST_ID)
        card = get_current_card(repo, create_list)

        if options.description:
            card._set_remote_attribute('description', options.description)

        if options.title or options.params:

            def sub_match(match):
                match_args = [arg for arg in match.groups()]

                if options.title:
                    match_args[4] = options.title

                if options.params:
                    params = check_params(options.params)

                    if (len(params) > 2):
                        match_args[2] = params[2]

                    elif (len(params) == 2):
                        match_args[1] = params[1]
                    
                    match_args[3] = params[0]

                return '#%s. %sº (%s,%s) %s' % tuple(match_args)

            name = re.sub('#(\d+).(\d+)º \((\d+),(\d+)\) (.*)', sub_match, card.name)
            card._set_remote_attribute('name', name)

    elif ('members' in args):
        for idx, member_id in enumerate(MEMBERS):
            member = client.get_member(member_id)

            logging.info("*%s %d. %s (%s)" % ((USER == member_id) and '*' or '', 
                idx, member.username, member.full_name))

    elif ('config' in args):
        if options.params:
            params = options.params.split(',')

            for param in params:
                try:
                    key, value = param.split(':')
#.........这里部分代码省略.........
开发者ID:gitplof,项目名称:git-trello,代码行数:103,代码来源:gitr.py

示例2:

# 需要导入模块: from trello import TrelloClient [as 别名]
# 或者: from trello.TrelloClient import get_member [as 别名]
print "Finding Board"
for b in client.list_boards():
  if b.name == strboardname:
    print "Found Board - " + strboardname
    for l in b.all_lists():
      if l.name == 'Information':
        continue
      f.write("<H2><U>" + l.name + "</U></H2>")
      #print l.name
      for c in l.list_cards():
        print "Fetching Card Comments -", c.name
        c.fetch()
        members = ''
        for m in c.member_id:
          member = client.get_member(m)
          if members == '':
            members += member.full_name
          else:
            members += ", "
            members += member.full_name
        #print "\t", c.name, "(", members, ")"
        f.write("<H3>" + c.name + "(" + members + ")</H3>")
        f.write("<UL>")
 
        for comment in c.comments:
           #print "\t\t", c.comments
           commentdatetime = datetime.datetime.strptime(comment['date'], '%Y-%m-%dT%H:%M:%S.%fZ')
           commentdate = commentdatetime.strftime('%m/%d/%Y %H:%M')
           if lastdate <= commentdatetime.date() <= today:
              #print commentdate, comment['data']['text']
开发者ID:jonjozwiak,项目名称:trello-status,代码行数:32,代码来源:status_report.py

示例3: TrelloBoardTestCase

# 需要导入模块: from trello import TrelloClient [as 别名]
# 或者: from trello.TrelloClient import get_member [as 别名]

#.........这里部分代码省略.........
        self.assertIsInstance(self._board.all_cards(), list)
        self.assertIsInstance(self._board.open_cards(), list)
        self.assertIsInstance(self._board.closed_cards(), list)

    def test52_add_card_set_due(self):
        name = "Testing from Python"
        description = "Description goes here"
        card = self._list.add_card(name, description)

        # Set the due date to be 3 days from now
        today = datetime.today()
        day_detla = timedelta(3)
        due_date = today + day_detla
        card.set_due(due_date)
        expected_due_date = card.due
        # Refresh the due date from cloud
        card.fetch()
        actual_due_date = card.due[:10]
        self.assertEquals(expected_due_date, actual_due_date)
        # Note that set_due passes only the date, stripping time
        self.assertEquals(card.due_date.date(), due_date.date())

    def test53_checklist(self):
        name = "Testing from Python"
        description = "Description goes here"
        card = self._list.add_card(name, description)

        name = 'Checklists'
        checklist = card.add_checklist(name,
                                       ['item1', 'item2'])
        self.assertIsNotNone(checklist, msg="checklist is None")
        self.assertIsNotNone(checklist.id, msg="id not provided")
        self.assertEquals(checklist.name, name)
        checklist.rename('Renamed')
        self.assertEquals(checklist.name, 'Renamed')

    def test54_set(self):
        name = "Testing from Python"
        description = "Description goes here"
        card = self._list.add_card('noname')
        card.set_name(name)
        card.set_description(description)
        self.assertEquals(card.name, name)
        self.assertEquals(card.description, description)

    def test55_set_pos(self):
        card_names = lambda: [c.name for c in self._list.list_cards()]
        self._list.add_card('card1')
        card2 = self._list.add_card('card2')
        names = card_names()
        self.assertGreater(names.index('card2'), names.index('card1'))

        card2.set_pos('top')
        names = card_names()
        self.assertGreater(names.index('card1'), names.index('card2'))

        card2.set_pos('bottom')
        names = card_names()
        self.assertGreater(names.index('card2'), names.index('card1'))

    def test60_delete_cards(self):
        cards = self._board.get_cards()
        for card in cards:
            card.delete()

    def test70_all_members(self):
        self.assertTrue(len(self._board.all_members()) > 0)

    def test71_normal_members(self):
        self.assertTrue(len(self._board.normal_members()) >= 0)

    def test72_admin_members(self):
        self.assertTrue(len(self._board.admin_members()) > 0)

    def test73_owner_members(self):
        members = self._board.owner_members()
        self.assertTrue(len(members) > 0)
        member = members[0].fetch()
        self.assertNotEqual(member.status, None)
        self.assertNotEqual(member.id, None)
        self.assertNotEqual(member.bio, None)
        self.assertNotEqual(member.url, None)
        self.assertNotEqual(member.username, None)
        self.assertNotEqual(member.full_name, None)
        self.assertNotEqual(member.initials, None)
        member2 = self._trello.get_member(member.id)
        self.assertEqual(member.username, member2.username)

    def test80_unauthorized(self):
        client = TrelloClient('a')
        self.assertRaises(Unauthorized,
                          client.list_boards)

    def test81_resource_unavailable(self):
        self.assertRaises(ResourceUnavailable,
                          self._trello.get_card, '0')

    def test90_get_board(self):
        board = self._trello.get_board(self._board.id)
        self.assertEqual(self._board.name, board.name)
开发者ID:AlfiyaZi,项目名称:py-trello,代码行数:104,代码来源:test_trello.py


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