Ejemplo n.º 1
0
    def get_project_versions(self, project_key):
        url = JIRA_API_URL + 'project/' + project_key + '/versions'
        result = make_http_request(url, headers=self.get_headers())
        if not result:
            raise JiraConnectionError

        try:
            return json.loads(result)
        except JSONDecodeError:
            raise JiraError
Ejemplo n.º 2
0
    def get_issue(self, key):
        url = JIRA_API_URL + 'issue/' + key

        result = make_http_request(url, headers=self.get_headers())
        if not result:
            raise JiraConnectionError

        try:
            issue = json.loads(result)
        except JSONDecodeError:
            raise JiraError
        else:
            return issue
Ejemplo n.º 3
0
    def get_my_permissions(self):
        url = JIRA_API_URL + 'mypermissions'
        result = make_http_request(url, headers=self.get_headers())
        if not result:
            raise JiraConnectionError

        try:
            data = json.loads(result)
            permissions = data['permissions']
        except (JSONDecodeError, KeyError, TypeError):
            raise JiraError
        else:
            return permissions
Ejemplo n.º 4
0
    def get_project_repos(self, project):
        url = BITBUCKET_API_URL + 'projects/' + project + '/repos?limit=1000'
        result = make_http_request(url, headers=self.get_headers())
        if not result:
            raise BitbucketConnectionError

        try:
            data = json.loads(result)
            repositories = data['values']
        except (JSONDecodeError, KeyError):
            raise BitbucketError
        else:
            return repositories
Ejemplo n.º 5
0
    def get_commits(self, project, repo, params):
        query = urlencode(params)
        url = BITBUCKET_API_URL + 'projects/' + project + '/repos/' + repo + '/commits?' + query
        result = make_http_request(url, headers=self.get_headers())
        if not result:
            raise BitbucketConnectionError

        try:
            data = json.loads(result)
            commits = data['values']
        except (JSONDecodeError, KeyError):
            raise BitbucketError
        else:
            return commits
Ejemplo n.º 6
0
    def get_issues(self, jql):
        url = JIRA_API_URL + 'search'
        query = urlencode({'jql': jql, 'maxResults': 100000})

        result = make_http_request(url + '?' + query,
                                   headers=self.get_headers())
        if not result:
            raise JiraConnectionError

        try:
            data = json.loads(result)
            issues = data['issues']
        except (JSONDecodeError, KeyError):
            raise JiraError
        else:
            return issues