本文整理汇总了Python中jira.JIRA.attachment方法的典型用法代码示例。如果您正苦于以下问题:Python JIRA.attachment方法的具体用法?Python JIRA.attachment怎么用?Python JIRA.attachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jira.JIRA
的用法示例。
在下文中一共展示了JIRA.attachment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from jira import JIRA [as 别名]
# 或者: from jira.JIRA import attachment [as 别名]
class JiraProject:
"""
Client in charge to retrieve all issues and comments
for a given JIRA project
"""
def __init__(self, jira_url, project_key):
self.jira_url = jira_url
self.jira_client = JIRA(
options={'server': self.jira_url, 'verify': False},
validate=False)
self.project_key = project_key
def get_comments(self, issue):
return self.jira_client.issue(issue.key, expand='comments')
def get_project_versions(self):
return self.jira_client.project_versions(self.project_key)
@staticmethod
def get_attachments(issue):
try:
return issue.fields.attachment
except AttributeError:
return None
@staticmethod
def get_assignee(issue):
try:
return issue.fields.assignee.name
except AttributeError:
return None
@staticmethod
def get_creation_datetime(issue):
return issue.fields.created
@staticmethod
def get_fix_version(issue):
try:
fix_versions = issue.fields.fixVersions
if len(fix_versions) > 0:
return fix_versions[0].name
else:
return None
except AttributeError:
return None
@staticmethod
def get_priority(issue):
try:
return issue.fields.priority.name
except AttributeError:
return None
@staticmethod
def get_resolution(issue):
if issue.fields.resolution is not None:
return issue.fields.resolution.name
else:
return None
@staticmethod
def get_title(issue):
return issue.fields.summary
@staticmethod
def get_type(issue):
return issue.fields.issuetype.name
@staticmethod
def is_closed(issue):
return issue.fields.resolution is not None
def get_issues(self):
start_index = 0
max_nb_results = 100
result = []
# while start_index < max_nb_results:
while True:
issues = self.jira_client.search_issues(
'project=' + self.project_key,
startAt=start_index,
maxResults=max_nb_results)
result.extend(issues)
if len(issues) == 0 or len(issues) < max_nb_results:
break
else:
start_index += max_nb_results
return sorted(result, key=lambda issue: int(
issue.key[issue.key.index('-') + 1:]))
def get_attachment_information(self):
start_index = 0
#.........这里部分代码省略.........