与jiraapi交互的轻量级库

jirasession的Python项目详细描述


圣战

A light weight library to interact with the Jira API

文件

圣战

JiraSession和JiraUser对象的文档

在圣战会议在

在日积月累.session.jirasession(self,用户名:str,令牌:str,服务器:str,会话:请求.sessions.Session=无,最大重试次数:int=3,pool_connections:int=16,pool_maxsize:int=16,resolve_status_codes:list=[200,201,204])

JirasSession对象可以从导入圣战会议或者来自圣战组织

JiraSession.__init__(self, username: str, token: str, server: str, session: requests.sessions.Session = None, max_retries: int = 3, pool_connections: int = 16, pool_maxsize: int = 16, resolve_status_codes: list = [200, 201, 204])

JiraSession初始化

JiraSession._resolver(self, request: functools.partial) -> requests.models.Response

尝试解决错误请求 不要单独调用此方法

JiraSession.account_info(self) -> requests.models.Response

^{pr2}$

JiraSession.add_attachment(self, issue_key: str, filepath: str) -> requests.models.Response

    add an attachment to an issue

    issue_key {str} -- id or key of issue to add attachment
    filepath {str} -- path to file to use as attachment

    return {requests.Response} -- response from attachment route

JiraSession.add_comment(self, issue_key: str, comment: str) -> requests.models.Response

    add a new comment to a issue

    issue_key {str} -- issue key to pull available transitions from
    comment {str} -- string to add as comment

    return {requests.Response} -- response from post to comment route

JiraSession.assign_issue(self, issue_key: str, accountid: str) -> requests.models.Response

    assign a issue to the current user accountid

    issue_key {str} -- newly created issue key

JiraSession.assign_to_me(self, issue_key: str) -> requests.models.Response

    assign to yourself based on jirauser.userid
    issue {str} -- issue key to assign to yourself

JiraSession.create_issue(self, content: dict) -> requests.models.Response

    create a new issue

    content {dict} -- dictionary of issue content

    return {requests.Response} -- response from post

JiraSession.delete_issue(self, issue_key: str, delete_subtasks: bool = False) -> requests.models.Response

    delete and issue by id

    issue_key {str} -- key of issue to delete

    return {requests.Response} -- response from delete

JiraSession.get_all_comments(self, issue_key: str, orderby: str = 'created', expand: bool = False) -> list

获取问题的所有评论

    issue_key {str} -- issue key to get comments for
    orderby {str} -- order comments by created date, other options [-created, +created]
    expand {bool} -- if true, renderBody will be sent to get comments rendered in html

    return {list} -- return list of comments from issue

JiraSession.get_comments(self, issue_key: str, start: int = 0, maxresults: int = 50, orderby: str = 'created', expand: bool = False) -> requests.models.Response

获取问题的评论

    issue_key {str} -- issue key to get comments for
    start {int} -- start index for retrieval
    maxresults {int} -- max number of comments to retrieve [default: 50]
    orderby {str} -- order comments by created date, other options [-created, +created]
    expand {bool} -- if true, renderBody will be sent to get comments rendered in html

    return {requests.Response} -- response from comments route

JiraSession.get_issue(self, issue_key: str, fields: list = ['*all'], expand: dict = {}) -> requests.models.Response

    get jira issue by id

    issue_key {str} -- key of issue to get
    fields {list} -- fields to retrieve, add a '-' to a field to remove it. Default: *all
    expand {dict} -- custom expand for search, use jira api docs to further expand

    return {requests.Response} -- response from issue route (GET)

JiraSession.get_issues_from_project(self, project_key: str, maxresults: int = None) -> list

    retrieve all issues from a given project id
    project_key {str} -- project key, example: DEV
    maxresults {int} -- max number of results

    return {list} -- issues

JiraSession.get_jira_user(self, username: Union[str, list]) -> requests.models.Response

    get user information for jira users by usernames

    username {Union[str, list]} -- a username or list of usernames

    return {requests.Response} -- the response from the user bulk route

JiraSession.get_project_issuetypes(self, project_key: str) -> list

    get the available issue types for a project

    project_key {str} -- key for project

    return {list} -- issuetypes found for the given project

JiraSession.get_transitions_from_issue(self, issue_key: str) -> requests.models.Response

    get the available transitions for a issue

    issue_key {str} -- issue key to pull available transitions from

    return {requests.Response} -- response from get to transitions route

JiraSession.jira_priorities_list(self) -> list

    get the available priorities for a project

    project_key {str} -- key for project

    return {list} -- priorities found for the given project

JiraSession.link_issues(self, in_issue_key: str, out_issue_key: str, link_type: str = 'relates to', comment: dict = None) -> requests.models.Response

将两个问题链接在一起,输入和输出将与jira api路由有关,但对功能没有影响

    in_issue_key {str} -- the issue to link from
    out_issue_key {str} -- the issue to link to
    link_type {str] -- type of link, default: Relates To
    comment {dict} [optional] -- comment for linking of issues
    
    return {requests.Response} -- response from issuelink route

JiraSession.link_types(self) -> requests.models.Response

    retrieve the link types for jira issues

    return {requests.Response} -- response from issueLinkType route

JiraSession.search(self, jql: str, start: int = 0, maxresults: int = 50, fields: list = ['*all'], validate: bool = True, validate_level: str = 'strict', expand: dict = {}) -> requests.models.Response

    search jira using a jql statement
    jql {str} -- jql string to search and validate if chosen
    start {int} -- start index
    maxresults {int} -- max number of results per page
    fields {list} -- fields to retrieve, add a '-' to a field to remove it. Default: *all
    validate {bool} -- to validate jql string upon search
    validate_level {str} -- validation level: strict, warn, none. Default: strict
    expand {dict} -- custom expand for search, use jira api docs to further expand

    return {requests.Response} -- response from search route (POST)

JiraSession.track_issue_time(self, issue_key: str, time_spent: str) -> requests.models.Response

    add time for time tracking application for a issue

    issue_key {str} -- issue key to pull available transitions from
    time_spent {str} -- jira format time. ex: 1d 2h 3m

    return {requests.Response} -- response from post to worklog route

JiraSession.transition_issue(self, issue_key: str, transition_state_id: str) -> requests.models.Response

^{pr21}$

JiraSession.update_issue(self, issue_key: str, content: dict) -> requests.models.Response

    update an issue by id

    issue_key {str} -- key of issue to update
    content {dict} -- dictionary of issue content

    return {requests.Response} -- response from put

在jirasession.user在

在jirasession.user.JiraUser公司(self,用户名:str=None,令牌:str=None,服务器:str=None)

经过身份验证的Jira用户

JiraUser.__init__(self, username: str = None, token: str = None, server: str = None)

一个JiraUser对象,包含经过身份验证的用户的信息

    username {str} -- username for jira account
    token {str} -- api token for jira account
    server {str} -- server to build rest url from

JiraUser.account_information(self) -> requests.models.Response

从用户名和令牌获取jira帐户的帐户信息

    return {requests.Response} response from myself route

基本示例

fromjirasessionimportJiraSessionsession=JiraSession('email','token','https://server.atlassian.net/')new_isssue={'project':{'key':'DEV'},'summary':'test','description':'test','issuetype':{'name':'Ticket'}}resp=session.create_issue(new_isssue)ifresp.status_code==200:print('issue created')# handle requests.Response to get issue informationelse:print('error creating issue')# debug requests.Response here

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
javascript如何找到socket。同一局域网上的IO服务器?   将Java代码格式化为Word/RTF格式   java学习对象以及如何将分配的变量封装到私有变量   java Websocket客户端不在Tomcat中工作   java如何在点击按钮时打开本机表情键盘?   java使用哪个Maven GlassFish插件?   Eclipse Java构建路径不允许添加外部JAR   继承Java6集合。勾选适当的用法   JavaApacheDateUtils:使用多个模式解析日期   java hibernate如何生成查询?   具有id或链接的java Dropbox下载文件或文件夹   java模态对话框未在PrimeFaces 5上显示   java将类对象转换为人类可读的字符串   更新数据库中字段的java通用方法   java无法通过Apache Tomcat访问网络文件夹