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
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
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
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
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
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