##// END OF EJS Templates
webhook: updated docs/examples.
marcink -
r3375:7adf2b03 default
parent child Browse files
Show More
@@ -118,8 +118,7 b' class WebhookSettingsSchema(colander.Sch'
118 method_type = colander.SchemaNode(
118 method_type = colander.SchemaNode(
119 colander.String(),
119 colander.String(),
120 title=_('Call Method'),
120 title=_('Call Method'),
121 description=_('Select if the Webhook call should be made '
121 description=_('Select a HTTP method to use when calling the Webhook.'),
122 'with POST, GET or PUT.'),
123 default='post',
122 default='post',
124 missing='',
123 missing='',
125 widget=deform.widget.RadioChoiceWidget(
124 widget=deform.widget.RadioChoiceWidget(
@@ -187,8 +186,7 b' class WebhookIntegrationType(Integration'
187 handler = WebhookDataHandler(template_url, headers)
186 handler = WebhookDataHandler(template_url, headers)
188
187
189 url_calls = handler(event, data)
188 url_calls = handler(event, data)
190 log.debug('webhook: calling following urls: %s',
189 log.debug('webhook: calling following urls: %s', [x[0] for x in url_calls])
191 [x[0] for x in url_calls])
192
190
193 run_task(post_to_webhook, url_calls, self.settings)
191 run_task(post_to_webhook, url_calls, self.settings)
194
192
@@ -214,7 +212,9 b' def post_to_webhook(url_calls, settings)'
214 'parents': [{'raw_id': '431b772a5353dad9974b810dd3707d79e3a7f6e0'}],
212 'parents': [{'raw_id': '431b772a5353dad9974b810dd3707d79e3a7f6e0'}],
215 'permalink_url': u'http://rc.local:8080/_7/changeset/a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf',
213 'permalink_url': u'http://rc.local:8080/_7/changeset/a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf',
216 'raw_id': 'a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf',
214 'raw_id': 'a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf',
217 'refs': {'bookmarks': [], 'branches': [u'default'], 'tags': [u'tip']},
215 'refs': {'bookmarks': [],
216 'branches': [u'default'],
217 'tags': [u'tip']},
218 'reviewers': [],
218 'reviewers': [],
219 'revision': 9L,
219 'revision': 9L,
220 'short_id': 'a815cc738b96',
220 'short_id': 'a815cc738b96',
@@ -228,11 +228,11 b' def post_to_webhook(url_calls, settings)'
228 'url': u'http://rc.local:8080/hg-repo'},
228 'url': u'http://rc.local:8080/hg-repo'},
229 'server_url': u'http://rc.local:8080',
229 'server_url': u'http://rc.local:8080',
230 'utc_timestamp': datetime.datetime(2017, 11, 30, 13, 0, 1, 569276)
230 'utc_timestamp': datetime.datetime(2017, 11, 30, 13, 0, 1, 569276)
231 }
232 """
231
233
232 """
233 call_headers = {
234 call_headers = {
234 'User-Agent': 'RhodeCode-webhook-caller/{}'.format(
235 'User-Agent': 'RhodeCode-webhook-caller/{}'.format(rhodecode.__version__)
235 rhodecode.__version__)
236 } # updated below with custom ones, allows override
236 } # updated below with custom ones, allows override
237
237
238 auth = get_auth(settings)
238 auth = get_auth(settings)
@@ -247,8 +247,7 b' def post_to_webhook(url_calls, settings)'
247 headers = headers or {}
247 headers = headers or {}
248 call_headers.update(headers)
248 call_headers.update(headers)
249
249
250 log.debug('calling Webhook with method: %s, and auth:%s',
250 log.debug('calling Webhook with method: %s, and auth:%s', call_method, auth)
251 call_method, auth)
252 if settings.get('log_data'):
251 if settings.get('log_data'):
253 log.debug('calling webhook with data: %s', data)
252 log.debug('calling webhook with data: %s', data)
254 resp = call_method(url, json={
253 resp = call_method(url, json={
General Comments 0
You need to be logged in to leave comments. Login now