FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Implement slack integration service. · python-gitlab/python-gitlab@08e7d5d · GitHub

Repository navigation

Commit 08e7d5d

Browse files
Marco Antonio Blos de Souza
committed
Implement slack integration service.
1 parent e0f2290 commit 08e7d5d

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎gitlab/exceptions.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class GitlabMRClosedError(GitlabOperationError):
110110
class GitlabMROnBuildSuccessError(GitlabOperationError):
111111
pass
112112

113+
class GitlabServiceSlackError(GitlabOperationError):
114+
pass
115+
113116

114117
def raise_error_from_response(response, error, expected_code=200):
115118
"""Tries to parse gitlab error message from response and raises error.

‎gitlab/objects.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,11 @@ def update_file(self, path, branch, content, message, **kwargs):
19561956
r = self.gitlab._raw_put(url, data=None, content_type=None, **kwargs)
19571957
raise_error_from_response(r, GitlabUpdateError)
19581958

1959+
def slack_service(self, webhook, username=None, channel=None, **kwargs):
1960+
url = "/projects/%s/services/slack" % self.id
1961+
r = self.gitlab._raw_put(url, data={'webhook': webhook, 'username': username, 'channel': channel}, **kwargs)
1962+
raise_error_from_response(r, GitlabServiceSlackError)
1963+
19591964
def delete_file(self, path, branch, message, **kwargs):
19601965
warnings.warn("`delete_file` is deprecated, "
19611966
"use `files.delete()` instead",

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL