Jira Create Issue с ​​использованием Python

Я пытаюсь создать Jira Issue с ​​помощью python, но при вызове нового метода проблемы, приводящего к появлению ошибки ниже, кажется, что я что-то упускаю или не пытаюсь сделать правильный путь, поля частоты отчета, типа запроса отчета и даты выполнения обязательны поля. Может кто-нибудь помочь мне с ошибкой?

jira.exceptions.JIRAError: JiraError HTTP 400 url: https://neomediaworld.atlassian.net/rest/api/2/issue
    text: Field 'report frequency' cannot be set. It is not on the appropriate screen, or unknown., Field 'report request type' cannot be set. It is not on the appropriate screen, or unknown., Field 'due date' cannot be set. It is not on the appropriate screen, or unknown., Field 'market' cannot be set. It is not on the appropriate screen, or unknown.

    response headers = {'X-AUSERNAME': 'Dharmendra.mishra', 'X-AREQUESTID': '675ecad3-1149-4673-b283-d86a55292d01', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'Transfer-Encoding': 'chunked', 'X-Seraph-LoginReason': 'OK', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains; preload', 'ATL-TraceId': '49a1e4174e1f0c65', 'ATL-TCS-Time': 'Cache Hit', 'Server': 'Atlassian Proxy/1.13.6.2', 'Connection': 'close', 'Cache-Control': 'no-cache, no-store, no-transform', 'Date': 'Mon, 29 Oct 2018 08:15:59 GMT', 'Content-Type': 'application/json;charset=UTF-8'}
    response text = {"errorMessages":[],"errors":{"market":"Field 'market' cannot be set. It is not on the appropriate screen, or unknown.","due date":"Field 'due date' cannot be set. It is not on the appropriate screen, or unknown.","report frequency":"Field 'report frequency' cannot be set. It is not on the appropriate screen, or unknown.","report request type":"Field 'report request type' cannot be set. It is not on the appropriate screen, or unknown."}}

Код как ниже.

from jira import JIRA
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
import datetime


class JiraException(Exception):
    pass


class Jira(object):

    def __init__(self, **kwargs):

        self.options = {
            'server': 'https://neomediaworld.atlassian.net',
            'verify': False
        }

        self.client = None

        if len(kwargs) != 2:
            raise JiraException(
                'In order to use this class you need to specify a user and a password as keyword arguments!')
        else:
            if 'username' in kwargs.keys():
                self.username = kwargs['username']
            else:
                raise JiraException('You need to specify a username as keyword argument!')
            if 'password' in kwargs.keys():
                self.password = kwargs['password']
            else:
                raise JiraException('You need to specify a password as keyword argument!')

            try:
                self.client = JIRA(self.options, basic_auth=(self.username, self.password))
            except Exception:
                raise JiraException('Could not connect to the API, invalid username or password!')

    def get_projects(self, raw=False):
        projects = []
        for project in self.client.projects():
            if raw:
                projects.append(project)
            else:
                projects.append({'Name': str(project.key), 'Description': str(project.name)})
        return projects

    def new_issue(self):

        issue_dict = {
            'project': {'key': 'MOS'},
            'issuetype': {'name': 'Reporting'},
            'summary': 'Test',
            'market': 'AUS',
            'report request type': 'Ad hoc',
            'report frequency': 'Monthly',
            'description': 'test',
            'due date': '29/Oct/18'}

        new_issue = self.client.create_issue(fields=issue_dict)

0 ответов

Другие вопросы по тегам