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


Python jira.JIRA类代码示例

本文整理汇总了Python中jira.JIRA的典型用法代码示例。如果您正苦于以下问题:Python JIRA类的具体用法?Python JIRA怎么用?Python JIRA使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: main

def main():
    try:
        get_ipython
    except NameError:
        pass
    else:
        exit("Running ipython inside ipython isn't supported. :(")

    options, basic_auth, oauth = get_config()

    if basic_auth:
        basic_auth = (basic_auth['username'], basic_auth['password'])

    if oauth.get('oauth_dance') is True:
        oauth = oauth_dance(
            options['server'], oauth['consumer_key'], oauth['key_cert'], oauth['print_tokens'], options['verify'])
    elif not all((oauth.get('access_token'), oauth.get('access_token_secret'),
                  oauth.get('consumer_key'), oauth.get('key_cert'))):
        oauth = None

    jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)

    import IPython
    # The top-level `frontend` package has been deprecated since IPython 1.0.
    if IPython.version_info[0] >= 1:
        from IPython.terminal.embed import InteractiveShellEmbed
    else:
        from IPython.frontend.terminal.embed import InteractiveShellEmbed

    ip_shell = InteractiveShellEmbed(
        banner1='<JIRA Shell ' + __version__ + ' (' + jira.client_info() + ')>')
    ip_shell("*** JIRA shell active; client is in 'jira'."
             ' Press Ctrl-D to exit.')
开发者ID:frank-belldev,项目名称:jira,代码行数:33,代码来源:jirashell.py

示例2: update_jira

def update_jira(username, password):
    """Update time logs in Jira

    Current implementation uses basic authentication,
    future version will have better auth. For simplicity
    the toggl log should have issue number as timelog
    description.

    *username* to use to connect to Jira
    *password* for Jira authentication

    """
    url = CONFIG.get('jira')['url']
    jira = JIRA(
        options={'server': url},
        basic_auth=(username, password))

    time_logs = toggl.Connect('jira')
    get_logs = time_logs.get_time_logs()

    for each_log in get_logs:
        issue_id = each_log.get('description')
        try:
            issue = jira.issue(issue_id)
        except JIRAError:
            logging.warning('Failed to find issue-id {0}'.format(issue_id))
            continue

        # Compute time in hours and round to two decimal places
        time_in_hours = round(each_log['duration']/(60*60), 2)
        jira.add_worklog(issue, time_in_hours, comment='Updated using Jira API')
开发者ID:skarbot,项目名称:utils,代码行数:31,代码来源:timelogs.py

示例3: show

    def show(self, message, bug):
        """show lp ____: Show details of bug ___ on Launchpad"""
        launchpad = Launchpad.login_anonymously('just testing', 'production')

        self.say(
            self.render_lp(launchpad.bugs[bug]),
            message=message,
            html=True
        )

        jira = JIRA(
            basic_auth=(settings.JIRA_USER, settings.JIRA_PASS),
            server=settings.JIRA_HOST,
            validate=False,
            options={'verify': False}
        )

        issues = jira.search_issues(self.SEARCH_PATTERN % (
            settings.JIRA_PROJ, bug, bug))

        if len(issues) > 0:
            self.say("I also found a jira ticket for that", message=message)
            for issue in issues:
                self.say(
                    self.render_jira(issue),
                    message=message,
                    html=True
                )
开发者ID:grahamhayes,项目名称:will,代码行数:28,代码来源:launchpad.py

示例4: JiraIntegration

class JiraIntegration(object):

    def signIn(self, jiraurl, username, password):
        try:
            self.__authed_jira = JIRA(server=jiraurl,
                                      basic_auth=(username, password),
                                      logging=True,
                                      max_retries=3)
            return True
        except Exception:
            return False

    def signOut(self):
        try:
            self.__authed_jira.kill_session()
            return True
        except Exception:
            return False

    def getOpenIssues(self):
        issues = self.__authed_jira.search_issues("""assignee = currentUser() 
            and sprint in openSprints () 
            order by priority desc""", maxResults=5)
        return issues

    def getTitlesForMany(self, issue_id_list):
        issues = self.__authed_jira.search_issues(' key in (%s)' % issue_id_list.join(','))
        return issues

    def getTitleFor(self, issue_id):
        issues = self.__authed_jira.search_issues(' key in (%s)' % issue_id)
        return issues
开发者ID:sunnytambi,项目名称:QuickScrum,代码行数:32,代码来源:JiraIntegration.py

示例5: main

def main(repo, project):
    jira = JIRA(JIRA_URL, basic_auth=[JIRA_USERNAME, JIRA_PASSWORD])

    print("Connection to JIRA successfully established.")
    print("Fetching list of matching issues...")

    # Get issue list for all the issues that match given project
    issue_list = []
    for year in range(JIRA_YEAR_START, JIRA_YEAR_END + 1):
        jira_filter = JIRA_FILTER_TEMP.format(project=project, start=year, end=year+1)
        issue_list += jira.search_issues(jira_filter, maxResults=5000)

    # Sort issue list
    sorted_issue_list = list(sorted(
        issue_list,
        key=lambda i: int(i.key.split('-')[1])
    ))

    print(f"Fetching milestones...")
    milestone_map = generate_milestone_map(repo, sorted_issue_list)

    print(f"The script will process {len(sorted_issue_list)} matching issues now.")

    issue = jira.issue(sorted_issue_list[0].key)
    for issue_key in [i.key for i in sorted_issue_list]:
        issue = jira.issue(issue_key)
        data, comments = generate_issue_data(issue, milestone_map)
        comments.insert(0, generate_meta_comment(issue))
        download_attachments(issue)
        create_issue(repo, data, comments)
        time.sleep(REQUEST_SLEEP)
开发者ID:GothenburgBitFactory,项目名称:infrastructure,代码行数:31,代码来源:migrate.py

示例6: get_activity

    def get_activity(self, params):
        """
        Takes time entries in format and reports them into destinatin set in
        config. Entries are in following format:

        >>> (Record(date=datatime, comment="activity comment", task="TaskID"),
        ...  ...)
        """
        jira = JIRA(
            params['server'], basic_auth=(params['uname'], params['pswd']))

        # check issues assigned on user and is in targeted statuses, or status was chened in given period

        # TODO: dates seems to be random...
        statuses = ("Code Review", "In Progress")
        subquery_item = '(status CHANGED during ("{after}", "{before}") TO "{status}" and assignee = "{user}")'
        subquery = " or ".join(subquery_item.format(status=s, **params) for s in statuses)
        query = '''
            project={project}
            and (assignee = "{user}" and status in {statuses})
            or {subquery}'''.format(subquery=subquery, statuses=statuses, **params)
        issues = jira.search_issues(query, expand='changelog')

        # import pdb; pdb.set_trace()

        work_records = [
            WorkRecord(
                date=issue.fields.updated,
                comment=issue.fields.summary,
                task=issue.key,
                type=issue.fields.status.name)
            for issue in issues]
        return work_records
开发者ID:enkidulan,项目名称:dirtytimer,代码行数:33,代码来源:jira.py

示例7: create_jira

    def create_jira(self, username):
        options = {
            'server': '%s' % settings.JIRA_OPTS['URL'],
            'verify': settings.JIRA_OPTS.get('VERIFY_SSL', False)
        }
        project = self.cleaned_data.get('project')
        summary = self.cleaned_data.get('summary')
        issue_type = self.cleaned_data.get('issue_type')
        component = self.cleaned_data.get('component')
        description = self.cleaned_data.get('description')
        description += '*JIRA Created by:* %s' % username

        try:
            jconn = JIRA(options, basic_auth=(settings.JIRA_OPTS['USER'], settings.JIRA_OPTS['PASSWORD']))
        except Exception as e:
            logger.error('Error creating JIRA ticket :%s' % e)
            raise forms.ValidationError(u"Error connecting to JIRA ticket, please check the server logs")

        try:
            jira_ticket = jconn.create_issue(project=project, summary=summary, description=description,
                                             issuetype={'name': issue_type}, components=[{'name': component}])
        except Exception as e:
            logger.error('Error creating JIRA ticket project=%s, summary=%s,  issue_type=%s, description=%s,' % (project,
                                                                                                               summary,
                                                                                                               issue_type,
                                                                                                               description))
            logger.error('Server message %s' % e)
            msg = u"Error creating JIRA ticket, please check the project name and issue type. If that doesn't work then check the server logs"
            raise forms.ValidationError(msg)

        if isinstance(jira_ticket, jira.resources.Issue):
            return jira_ticket.key
        else:
            raise forms.ValidationError(u"Error creating JIRA ticket, JIRA server did not return a ticket key.")
开发者ID:amitbmas07,项目名称:cito_engine,代码行数:34,代码来源:jira_form.py

示例8: main

def main():
    try:
        get_ipython
    except NameError:
        pass
    else:
        exit("Running ipython inside ipython isn't supported. :(")

    options, basic_auth, oauth = get_config()

    if basic_auth:
        basic_auth = (basic_auth['username'], basic_auth['password'])

    if oauth['oauth_dance']:
        oauth = oauth_dance(
            options['server'], oauth['consumer_key'], oauth['key_cert'], oauth['print_tokens'], options['verify'])
    else:
        oauth = None

    jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)

    from IPython.frontend.terminal.embed import InteractiveShellEmbed

    ipshell = InteractiveShellEmbed(
        banner1='<JIRA Shell ' + __version__ + ' (' + jira.client_info() + ')>')
    ipshell("*** JIRA shell active; client is in 'jira'."
            ' Press Ctrl-D to exit.')
开发者ID:sebkouba,项目名称:jira,代码行数:27,代码来源:jirashell.py

示例9: GET

    def GET(self):
        gl.GL_WEBINPUT = web.input()
        projectname = gl.GL_WEBINPUT.product_name
        productline_list = gl.GL_DB.query("select distinct version from crashinfo where appName='" + projectname + "'")
        # select *, count(distinct name) from table group by name
        result = []
        result_g_version = []
        result_jira_version = []
        #jira = JIRA(server='http://127.0.0.1:1194', basic_auth=('wangyang', 'qwerty123456'))
        jira = JIRA(server=jira_server, basic_auth=(user_accout, user_pass))

        for name in project:
            if name in projectname:
                jira_name = project[name]["projectname"]

        versions = jira.project_versions(jira.project(jira_name))

        for item in productline_list:
            item_dict = {"game_version": item.version}
            result_g_version.append(item_dict)

        [result_jira_version.append({"jira_version": v.name}) for v in reversed(versions)]

        result.append(result_g_version)
        result.append(result_jira_version)

        encodedjson = json.dumps(result)

        return encodedjson
开发者ID:QAwangyang,项目名称:QAplatform,代码行数:29,代码来源:savecrash.py

示例10: Jira

class Jira(object):
    def __init__(self, url, user, password):
        self.jira = JIRA(url, auth=(user, password))

    def book_jira(self, bookings):
        for entry in bookings:
            if not ticket_pattern_jira.match(entry['issue_id']):
                continue
            rm_entry = entry.copy()

            rm_entry['hours'] = rm_entry['time'] / 60.
            del rm_entry['time']

            if 'description' in rm_entry:
                del rm_entry['description']
            if 'activity' in rm_entry:
                del rm_entry['activity']

            try:
                self.jira.add_worklog(
                    issue=entry['issue_id'],
                    timeSpent=entry['time'],
                    started=datetime.strptime(entry['spent_on'], '%Y-%m-%d'),
                    comment=entry['comments'],
                )
            except JIRAError as je:
                print(u'{0}: {1} ({2})'.format(
                    je.status_code, je.text, rm_entry['comments']))
开发者ID:reinhardt,项目名称:octodon,代码行数:28,代码来源:octodon.py

示例11: JiraHelper

class JiraHelper(object):
    def __init__(self, host, user="", password=""):
        self.host = host
        self.user = user
        self.password = password

        try:
            if user != "" and password != "":
                self.jira = JIRA(host, basic_auth=(user, password))
            else:
                self.jira = JIRA(host)
        except JIRAError as e:
            printErrorMsg('Error connecting to %s. Check if username and password are correct.' % (self.host))
            printJiraErrorAndExit(e)

    def getSummary(self, issue):
        """
        Gets the summary for the given ticket.
        """
        issueData = self.jira.issue(issue)
        return issueData.fields.summary

    def getIssues(self, issues):
        """
        Gets the issues from Jira with the given issue numbers.
        """
        result = []
        for issue in issues:
            result.append(self.jira.issue(issue))

        return result
开发者ID:hypebeast,项目名称:jira-info,代码行数:31,代码来源:jirahelper.py

示例12: comments

def comments(task):
    repo = Repo(os.getcwd())
    jr = JIRA({'server': JIRA_URL}, basic_auth=(JIRA_USER, JIRA_PASS))
    issue = jr.issue(task or repo.head.ref.name)
    for comment in issue.fields.comment.comments:
        click.echo('-----------------------------------------------------------')
        click.echo(click.style(comment.author.displayName + ': \n', fg='green'))
        click.echo('\r' + comment.body)
开发者ID:polinom,项目名称:pronto,代码行数:8,代码来源:cli.py

示例13: delete_issue

def delete_issue(request, find):
    j_issue = JIRA_Issue.objects.get(finding=find)
    jira_conf = find.jira_conf()
    jira = JIRA(server=jira_conf.url,
                basic_auth=(jira_conf.username,
                            jira_conf.password))
    issue = jira.issue(j_issue.jira_id)
    issue.delete()
开发者ID:devGregA,项目名称:django-DefectDojo,代码行数:8,代码来源:views.py

示例14: add_comment

def add_comment(find, note, force_push=False):
    prod = Product.objects.get(engagement=Engagement.objects.get(test=find.test))
    jpkey = JIRA_PKey.objects.get(product=prod)
    jira_conf = jpkey.conf
    if jpkey.push_notes or force_push == True:
        jira = JIRA(server=jira_conf.url, basic_auth=(jira_conf.username, jira_conf.password))
        j_issue = JIRA_Issue.objects.get(finding=find)
        jira.add_comment(j_issue.jira_id, '(%s): %s' % (note.author.get_full_name(), note.entry))
开发者ID:Q-jone,项目名称:django-DefectDojo,代码行数:8,代码来源:utils.py

示例15: get_jira_summary

def get_jira_summary(server, username, password, ticketId):
    try:
        jira = JIRA(server=server, basic_auth=(username, password), options={'verify':False})

        issue = jira.issue(ticketId, fields='summary')

        return issue.fields.summary
    except JIRAError, e:
        return "JIRA error: " + e.text
开发者ID:TuxTom,项目名称:vimfiles,代码行数:9,代码来源:jira_functions.py


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