python - 通过 Jira REST API 从 CustomFieldOption 数组中获取“值”
问题描述
我有一些代码通过 REST API 连接到 Jira,检索一些数据并将其打印回屏幕。这里是:
prod_server = 'https://jira.abc.com'
cust_session = JIRA(server=prod_server, basic_auth=(<user_name>, <password>))
issue = cust_session.issue('MED-98', expand='changelog')
changelog = issue.changelog
for history in changelog.histories:
for item in history.items:
if item.field == 'status' and item.fromString == 'Pending Approval':
print('Key:', issue.key, 'Category:', issue.fields.customfield_8361, ' Time:', history.created, 'By:', history.author)
这导致:
Key: MED-98 Category: [<JIRA CustomFieldOption: value='Marketing', id='37394'>] Time: 2021-03-15T08:20:08.484 By: Smith, James
Key: MED-98 Category: [<JIRA CustomFieldOption: value='Marketing', id='37394'>] Time: 2021-03-12T19:22:20.583 By: Jones, Mary
由于category
是自定义字段 ( customfield_8361
),因此它作为包含其和的数组输出。value
id
是否可以只value
输出(而不是整个数组)?
我的目标是使输出如下所示:
Key: MED-98 Category: Marketing Time: 2021-03-15T08:20:08.484 By: Smith, James
Key: MED-98 Category: Marketing Time: 2021-03-12T19:22:20.583 By: Jones, Mary
谢谢!
解决方案
推荐阅读
- node.js - Nest.Js 不接受任何更改
- java - 为什么我在 dato2 中看到“null”以返回我的第二个活动?
- android - 三星启动器 - 切换桌面屏幕启动应用程序
- python - 如何运行 django-admin 检查命令?
- android - 导航抽屉:返回活动时当前导航片段未更新
- mesh - FIPY:Grid2D cellToFaceDistanceVectors 的问题给出错误“UniformGrid2D”对象没有属性“_cellToFaceDistanceVectors”
- angular - 如何禁用 Mat-Expansion Panel 的全部内容?
- python - 在不违反阈值的情况下查找数字的乘积
- angular - AG-GRID:有没有办法在行上具有展开/折叠功能并在展开区域中显示自定义内容?
- sql - 区分 SQL / AWS Athena 和 AWS Quicksight 上的分组行