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


Python Rally.getAttachments方法代码示例

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


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

示例1: main

# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import getAttachments [as 别名]
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, username, password, apikey, workspace, project = rallyWorkset(options)
    print " | ".join([server, username, password, workspace, project])
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    rally.enableLogging('rally.hist.getattachs') # name of file you want logging to go to

    if len(args) != 2:
        errout(USAGE)
        sys.exit(2)
    entity_name, ident = args
    if entity_name in STORY_ALIASES:
        entity_name = 'HierarchicalRequirement'

    mo = OID_PATT.match(ident)
    if mo:
        ident_query = 'ObjectID = %s' % ident
    else:
        mo = FORMATTED_ID_PATT.match(ident)
        if mo:
            ident_query = 'FormattedID = "%s"' % ident
        else:
            errout('ERROR: Unable to determine ident scheme for %s\n' % ident)
            sys.exit(3)

    response = rally.get(entity_name, fetch=True, query=ident_query, 
                         workspace=workspace, project=project)

    if response.errors:
        errout("Request could not be successfully serviced, error code: %d\n" % response.status_code)
        errout("\n".join(response.errors))
        sys.exit(1)

    if response.resultCount == 0:
        errout('No item found for %s %s\n' % (entity_name, ident))
        sys.exit(4)
    elif response.resultCount > 1:
        errout('WARNING: more than 1 item returned matching your criteria\n')

    artifact = response.next()
    attachments = rally.getAttachments(artifact)
    for attachment in attachments:
        print("-" * 32)
        print(attachment.Name)
        print("~" * len(attachment.Name))
        print(attachment.Content)
        print("")
        print("=" *  64)
开发者ID:RallyTools,项目名称:RallyRestToolkitForPython,代码行数:54,代码来源:get_attachments.py


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