DEBUG log when trying to git.io-shorten a github url
This commit is contained in:
parent
4006184385
commit
e6d8e75086
2 changed files with 6 additions and 1 deletions
|
@ -26,7 +26,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
_name = "Webhooks"
|
_name = "Webhooks"
|
||||||
|
|
||||||
def on_load(self):
|
def on_load(self):
|
||||||
self._github = github.GitHub()
|
self._github = github.GitHub(self.log)
|
||||||
self._gitea = gitea.Gitea()
|
self._gitea = gitea.Gitea()
|
||||||
|
|
||||||
@utils.hook("api.post.github")
|
@utils.hook("api.post.github")
|
||||||
|
|
|
@ -83,6 +83,9 @@ CHECK_RUN_CONCLUSION = {
|
||||||
CHECK_RUN_FAILURES = ["failure", "cancelled", "timed_out", "action_required"]
|
CHECK_RUN_FAILURES = ["failure", "cancelled", "timed_out", "action_required"]
|
||||||
|
|
||||||
class GitHub(object):
|
class GitHub(object):
|
||||||
|
def __init__(self, log):
|
||||||
|
self.log = log
|
||||||
|
|
||||||
def is_private(self, data, headers):
|
def is_private(self, data, headers):
|
||||||
if "repository" in data:
|
if "repository" in data:
|
||||||
return data["repository"]["private"]
|
return data["repository"]["private"]
|
||||||
|
@ -147,7 +150,9 @@ class GitHub(object):
|
||||||
return self.membership(organisation, data)
|
return self.membership(organisation, data)
|
||||||
elif event == "watch":
|
elif event == "watch":
|
||||||
return self.watch(data)
|
return self.watch(data)
|
||||||
|
|
||||||
def _short_url(self, url):
|
def _short_url(self, url):
|
||||||
|
self.log.debug("git.io shortening: %s" % url)
|
||||||
try:
|
try:
|
||||||
page = utils.http.request("https://git.io", method="POST",
|
page = utils.http.request("https://git.io", method="POST",
|
||||||
post_data={"url": url})
|
post_data={"url": url})
|
||||||
|
|
Loading…
Reference in a new issue