Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
#24 Get webhooks
Browse files Browse the repository at this point in the history
Signed-off-by: Uilian Ries <[email protected]>
  • Loading branch information
uilianries committed Jul 14, 2019
1 parent adb3501 commit 8a8fde7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bintray/bintray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1373,3 +1373,25 @@ def search_user(self, name):
response = self._requester.get(url, params=params)
self._logger.info("Get successfully")
return response

# Webhooks

def get_webhooks(self, subject, repo=None):
""" Get all the webhooks registered for the specified subject, optionally for a specific
repository.
failure_count is the number of times a callback has failed.
A callback will be auto-deactivated after 7 subsequent failures.
A successful callback resets the count.
:param subject: repository owner
:param repo: repository name
:return: list with web hooks
"""
url = "{}/webhooks/{}".format(Bintray.BINTRAY_URL, subject)
if isinstance(repo, str):
url += '/' + repo

response = self._requester.get(url)
self._logger.info("Get successfully")
return response
11 changes: 11 additions & 0 deletions tests/test_webhooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-

from bintray.bintray import Bintray


def test_webhooks():
bintray = Bintray()
response = bintray.get_webhooks("uilianries", "generic")
assert {'error': False, 'statusCode': 200} in response


0 comments on commit 8a8fde7

Please sign in to comment.