# HG changeset patch # User Marcin Kuzminski # Date 2019-01-08 17:54:20 # Node ID 7adf2b03d09d88f4c7640efd0171f83a5ca5de2b # Parent 6550d332434db09c767a6dcad54cf88be40daf88 webhook: updated docs/examples. diff --git a/rhodecode/integrations/types/webhook.py b/rhodecode/integrations/types/webhook.py --- a/rhodecode/integrations/types/webhook.py +++ b/rhodecode/integrations/types/webhook.py @@ -118,8 +118,7 @@ class WebhookSettingsSchema(colander.Sch method_type = colander.SchemaNode( colander.String(), title=_('Call Method'), - description=_('Select if the Webhook call should be made ' - 'with POST, GET or PUT.'), + description=_('Select a HTTP method to use when calling the Webhook.'), default='post', missing='', widget=deform.widget.RadioChoiceWidget( @@ -187,8 +186,7 @@ class WebhookIntegrationType(Integration handler = WebhookDataHandler(template_url, headers) url_calls = handler(event, data) - log.debug('webhook: calling following urls: %s', - [x[0] for x in url_calls]) + log.debug('webhook: calling following urls: %s', [x[0] for x in url_calls]) run_task(post_to_webhook, url_calls, self.settings) @@ -202,37 +200,39 @@ def post_to_webhook(url_calls, settings) 'actor_ip': u'192.168.157.1', 'name': 'repo-push', 'push': {'branches': [{'name': u'default', - 'url': 'http://rc.local:8080/hg-repo/changelog?branch=default'}], - 'commits': [{'author': u'Marcin Kuzminski ', - 'branch': u'default', - 'date': datetime.datetime(2017, 11, 30, 12, 59, 48), - 'issues': [], - 'mentions': [], - 'message': u'commit Thu 30 Nov 2017 13:59:48 CET', - 'message_html': u'commit Thu 30 Nov 2017 13:59:48 CET', - 'message_html_title': u'commit Thu 30 Nov 2017 13:59:48 CET', - 'parents': [{'raw_id': '431b772a5353dad9974b810dd3707d79e3a7f6e0'}], - 'permalink_url': u'http://rc.local:8080/_7/changeset/a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf', - 'raw_id': 'a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf', - 'refs': {'bookmarks': [], 'branches': [u'default'], 'tags': [u'tip']}, - 'reviewers': [], - 'revision': 9L, - 'short_id': 'a815cc738b96', - 'url': u'http://rc.local:8080/hg-repo/changeset/a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf'}], - 'issues': {}}, + 'url': 'http://rc.local:8080/hg-repo/changelog?branch=default'}], + 'commits': [{'author': u'Marcin Kuzminski ', + 'branch': u'default', + 'date': datetime.datetime(2017, 11, 30, 12, 59, 48), + 'issues': [], + 'mentions': [], + 'message': u'commit Thu 30 Nov 2017 13:59:48 CET', + 'message_html': u'commit Thu 30 Nov 2017 13:59:48 CET', + 'message_html_title': u'commit Thu 30 Nov 2017 13:59:48 CET', + 'parents': [{'raw_id': '431b772a5353dad9974b810dd3707d79e3a7f6e0'}], + 'permalink_url': u'http://rc.local:8080/_7/changeset/a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf', + 'raw_id': 'a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf', + 'refs': {'bookmarks': [], + 'branches': [u'default'], + 'tags': [u'tip']}, + 'reviewers': [], + 'revision': 9L, + 'short_id': 'a815cc738b96', + 'url': u'http://rc.local:8080/hg-repo/changeset/a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf'}], + 'issues': {}}, 'repo': {'extra_fields': '', - 'permalink_url': u'http://rc.local:8080/_7', - 'repo_id': 7, - 'repo_name': u'hg-repo', - 'repo_type': u'hg', - 'url': u'http://rc.local:8080/hg-repo'}, + 'permalink_url': u'http://rc.local:8080/_7', + 'repo_id': 7, + 'repo_name': u'hg-repo', + 'repo_type': u'hg', + 'url': u'http://rc.local:8080/hg-repo'}, 'server_url': u'http://rc.local:8080', 'utc_timestamp': datetime.datetime(2017, 11, 30, 13, 0, 1, 569276) + } + """ - """ call_headers = { - 'User-Agent': 'RhodeCode-webhook-caller/{}'.format( - rhodecode.__version__) + 'User-Agent': 'RhodeCode-webhook-caller/{}'.format(rhodecode.__version__) } # updated below with custom ones, allows override auth = get_auth(settings) @@ -247,8 +247,7 @@ def post_to_webhook(url_calls, settings) headers = headers or {} call_headers.update(headers) - log.debug('calling Webhook with method: %s, and auth:%s', - call_method, auth) + log.debug('calling Webhook with method: %s, and auth:%s', call_method, auth) if settings.get('log_data'): log.debug('calling webhook with data: %s', data) resp = call_method(url, json={