atlassian-python-api 3.41.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. atlassian/VERSION +1 -0
  2. atlassian/__init__.py +32 -0
  3. atlassian/bamboo.py +1343 -0
  4. atlassian/bitbucket/__init__.py +3572 -0
  5. atlassian/bitbucket/base.py +198 -0
  6. atlassian/bitbucket/cloud/__init__.py +24 -0
  7. atlassian/bitbucket/cloud/base.py +123 -0
  8. atlassian/bitbucket/cloud/common/__init__.py +1 -0
  9. atlassian/bitbucket/cloud/common/builds.py +85 -0
  10. atlassian/bitbucket/cloud/common/comments.py +50 -0
  11. atlassian/bitbucket/cloud/common/users.py +79 -0
  12. atlassian/bitbucket/cloud/repositories/__init__.py +437 -0
  13. atlassian/bitbucket/cloud/repositories/branchRestrictions.py +175 -0
  14. atlassian/bitbucket/cloud/repositories/commits.py +188 -0
  15. atlassian/bitbucket/cloud/repositories/defaultReviewers.py +94 -0
  16. atlassian/bitbucket/cloud/repositories/deploymentEnvironments.py +264 -0
  17. atlassian/bitbucket/cloud/repositories/diffstat.py +92 -0
  18. atlassian/bitbucket/cloud/repositories/groupPermissions.py +81 -0
  19. atlassian/bitbucket/cloud/repositories/hooks.py +117 -0
  20. atlassian/bitbucket/cloud/repositories/issues.py +164 -0
  21. atlassian/bitbucket/cloud/repositories/pipelines.py +274 -0
  22. atlassian/bitbucket/cloud/repositories/pullRequests.py +483 -0
  23. atlassian/bitbucket/cloud/repositories/refs.py +136 -0
  24. atlassian/bitbucket/cloud/repositories/repositoryVariables.py +146 -0
  25. atlassian/bitbucket/cloud/workspaces/__init__.py +146 -0
  26. atlassian/bitbucket/cloud/workspaces/members.py +62 -0
  27. atlassian/bitbucket/cloud/workspaces/permissions.py +125 -0
  28. atlassian/bitbucket/cloud/workspaces/projects.py +215 -0
  29. atlassian/bitbucket/server/__init__.py +46 -0
  30. atlassian/bitbucket/server/base.py +63 -0
  31. atlassian/bitbucket/server/common/__init__.py +1 -0
  32. atlassian/bitbucket/server/common/permissions.py +220 -0
  33. atlassian/bitbucket/server/globalPermissions.py +198 -0
  34. atlassian/bitbucket/server/projects/__init__.py +244 -0
  35. atlassian/bitbucket/server/projects/repos/__init__.py +327 -0
  36. atlassian/cloud_admin.py +32 -0
  37. atlassian/confluence.py +3336 -0
  38. atlassian/crowd.py +266 -0
  39. atlassian/errors.py +27 -0
  40. atlassian/insight.py +678 -0
  41. atlassian/jira.py +5324 -0
  42. atlassian/marketplace.py +84 -0
  43. atlassian/portfolio.py +108 -0
  44. atlassian/request_utils.py +39 -0
  45. atlassian/rest_client.py +558 -0
  46. atlassian/service_desk.py +911 -0
  47. atlassian/statuspage.py +3133 -0
  48. atlassian/utils.py +327 -0
  49. atlassian/xray.py +632 -0
  50. atlassian_python_api-3.41.13.dist-info/LICENSE +201 -0
  51. atlassian_python_api-3.41.13.dist-info/METADATA +261 -0
  52. atlassian_python_api-3.41.13.dist-info/RECORD +54 -0
  53. atlassian_python_api-3.41.13.dist-info/WHEEL +5 -0
  54. atlassian_python_api-3.41.13.dist-info/top_level.txt +1 -0
@@ -0,0 +1,84 @@
1
+ # coding=utf-8
2
+ import logging
3
+
4
+ from .rest_client import AtlassianRestAPI
5
+
6
+ log = logging.getLogger(__name__)
7
+
8
+
9
+ class MarketPlace(AtlassianRestAPI):
10
+ """Marketplace API wrapper."""
11
+
12
+ def get_plugins_info(self, limit=10, offset=10):
13
+ """
14
+ Provide plugins info
15
+ :param limit:
16
+ :param offset:
17
+ :return:
18
+ """
19
+ params = {}
20
+ if offset:
21
+ params["offset"] = offset
22
+ if limit:
23
+ params["limit"] = limit
24
+ url = "rest/1.0/plugins"
25
+ return (self.get(url, params=params) or {}).get("plugins")
26
+
27
+ def get_vendors_info(self, limit=10, offset=10):
28
+ """
29
+ Provide vendors info
30
+ :param limit:
31
+ :param offset:
32
+ :return:
33
+ """
34
+ params = {}
35
+ if offset:
36
+ params["offset"] = offset
37
+ if limit:
38
+ params["limit"] = limit
39
+ url = "rest/1.0/vendors"
40
+ return (self.get(url, params=params) or {}).get("vendors")
41
+
42
+ def get_application_info(self, limit=10, offset=10):
43
+ """
44
+ Information about applications
45
+ :param limit:
46
+ :param offset:
47
+ :return:
48
+ """
49
+ params = {}
50
+ if offset:
51
+ params["offset"] = offset
52
+ if limit:
53
+ params["limit"] = limit
54
+ url = "rest/2/applications"
55
+ return self.get(url, params=params)
56
+
57
+ def get_app_versions(self, add_on_key, application=None):
58
+ """
59
+ Get a list of versions for the specified app.
60
+ :param add_on_key: The unique identifier for this app,
61
+ for example "com.atlassian.confluence.plugins.confluence-questions"
62
+ :param application: Only returns apps compatible with this application
63
+ :return:
64
+ """
65
+ params = {}
66
+ if application:
67
+ params["application"] = application
68
+ url = "rest/2/addons/{addonKey}/versions".format(addonKey=add_on_key)
69
+ return self.get(url, params=params)
70
+
71
+ def get_app_reviews(self, add_on_key, sort=None):
72
+ """
73
+ Get a list of reviews for the specified app.
74
+ :param add_on_key: The unique identifier for this app,
75
+ for example "com.atlassian.confluence.plugins.confluence-questions"
76
+ :param sort: Specifies the review sort order
77
+ Valid values: helpful, recent
78
+ :return:
79
+ """
80
+ url = "rest/2/addons/{addonKey}/reviews".format(addonKey=add_on_key)
81
+ params = {}
82
+ if sort:
83
+ params["sort"] = sort
84
+ return self.get(url, params=params)
atlassian/portfolio.py ADDED
@@ -0,0 +1,108 @@
1
+ # coding=utf-8
2
+ import logging
3
+
4
+ from .rest_client import AtlassianRestAPI
5
+
6
+ log = logging.getLogger(__name__)
7
+
8
+
9
+ class Portfolio(AtlassianRestAPI):
10
+ def __init__(self, plan_id, *args, **kwargs):
11
+ self.plan_id = plan_id
12
+ super(Portfolio, self).__init__(*args, **kwargs)
13
+
14
+ def get_epic(self, epic):
15
+ key = [x.get("link", None) for x in epic.get("links", [])]
16
+ estimates = self.get_estimates_dict(epic["estimates"])
17
+ estimates.update(Total=sum(estimates.values()))
18
+ team_id = epic.get("teamId", None)
19
+ return {
20
+ "title": epic.get("title", None),
21
+ "team": self.get_team_name(team_id) if team_id else None,
22
+ "description": epic.get("description", None),
23
+ "issuekey": key[0] if key else None,
24
+ "estimates": estimates,
25
+ }
26
+
27
+ def get_plan(self):
28
+ url = "rest/roadmap/1.0/plans/{0}.json".format(self.plan_id)
29
+ return self.get(url)
30
+
31
+ def get_stages(self):
32
+ url = "rest/roadmap/1.0/plans/{0}/stages.json".format(self.plan_id)
33
+ return self.get(url)
34
+
35
+ def get_teams(self):
36
+ url = "rest/roadmap/1.0/plans/{0}/teams.json".format(self.plan_id)
37
+ return self.get(url)
38
+
39
+ def get_team_name(self, team_id):
40
+ all_teams = self.get_teams()["collection"]
41
+ return [team["title"] for team in all_teams if team["id"] == str(team_id)][0]
42
+
43
+ def get_config(self):
44
+ url = "rest/roadmap/1.0/plans/{0}/config.json".format(self.plan_id)
45
+ return self.get(url)
46
+
47
+ def get_persons(self):
48
+ url = "rest/roadmap/1.0/plans/{0}/persons.json".format(self.plan_id)
49
+ return self.get(url)
50
+
51
+ def get_streams(self):
52
+ url = "rest/roadmap/1.0/plans/{0}/streams.json".format(self.plan_id)
53
+ return self.get(url)
54
+
55
+ def get_releases(self):
56
+ return self.get_streams()
57
+
58
+ def get_themes(self):
59
+ url = "rest/roadmap/1.0/plans/{0}/themes.json".format(self.plan_id)
60
+ return self.get(url)
61
+
62
+ def get_state(self):
63
+ url = "rest/roadmap/1.0/scheduling/{0}/state.json".format(self.plan_id)
64
+ return self.get(url)
65
+
66
+ def get_filter(self, limit=500):
67
+ url = "rest/roadmap/1.0/plans/{0}/workitems/filter.json".format(self.plan_id)
68
+ return self.post(url, data={"limit": limit})
69
+
70
+ def get_filters(self, query_string):
71
+ url = "rest/roadmap/1.0/system/filters.json?queryString={0}".format(query_string)
72
+ return self.get(url)
73
+
74
+ def get_dependencies(self, workitem_id, plan_version):
75
+ url = "rest/roadmap/1.0/workitems/{0}/dependencies.json?planVersion={1}".format(workitem_id, plan_version)
76
+ return self.get(url)
77
+
78
+ def get_stage_name(self, stage_id):
79
+ all_stages = self.get_stages()["collection"]
80
+ return [stage["title"] for stage in all_stages if stage["id"] == str(stage_id)][0]
81
+
82
+ def get_estimates_dict(self, estimates):
83
+ return {self.get_stage_name(stage["targetId"]): stage["value"] for stage in estimates["stages"]}
84
+
85
+ def import_workitem(self, data):
86
+ url = "rest/roadmap/1.0/plans/bulk/{0}/workitems.json".format(self.plan_id)
87
+ return self.post(url, data=data)
88
+
89
+ def get_jql_issues(
90
+ self,
91
+ jql,
92
+ limit=500,
93
+ exclude_linked=True,
94
+ estimation_method="estimates",
95
+ epic_fetch_enabled=True,
96
+ load_story_points=True,
97
+ ):
98
+ url = "rest/roadmap/1.0/system/import.json"
99
+ data = {
100
+ "planId": str(self.plan_id),
101
+ "query": jql,
102
+ "excludeLinked": exclude_linked,
103
+ "epicFetchEnabled": epic_fetch_enabled,
104
+ "maxResults": limit,
105
+ "estimationMethod": estimation_method,
106
+ "loadStoryPoints": load_story_points,
107
+ }
108
+ return self.post(url, data=data)["data"]["items"]
@@ -0,0 +1,39 @@
1
+ import logging
2
+
3
+ from six import PY3
4
+
5
+
6
+ # Additional log methods
7
+ def logger_has_handlers(logger):
8
+ """Since Python 2 doesn't provide Logger.hasHandlers(), we have to
9
+ perform the lookup by ourselves."""
10
+
11
+ if PY3:
12
+ return logger.hasHandlers()
13
+ else:
14
+ c = logger
15
+ rv = False
16
+ while c:
17
+ if c.handlers:
18
+ rv = True
19
+ break
20
+ if not c.propagate:
21
+ break
22
+ else:
23
+ c = c.parent
24
+ return rv
25
+
26
+
27
+ def get_default_logger(name):
28
+ """Get a logger from default logging manager. If no handler
29
+ is associated, add a default NullHandler"""
30
+
31
+ logger = logging.getLogger(name)
32
+ if not logger_has_handlers(logger):
33
+ # If logging is not configured in the current project, configure
34
+ # this logger to discard all logs messages. This will prevent
35
+ # the 'No handlers could be found for logger XXX' error on Python 2,
36
+ # and avoid redirecting errors to the default 'lastResort'
37
+ # StreamHandler on Python 3
38
+ logger.addHandler(logging.NullHandler())
39
+ return logger