##// 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 118 method_type = colander.SchemaNode(
119 119 colander.String(),
120 120 title=_('Call Method'),
121 description=_('Select if the Webhook call should be made '
122 'with POST, GET or PUT.'),
121 description=_('Select a HTTP method to use when calling the Webhook.'),
123 122 default='post',
124 123 missing='',
125 124 widget=deform.widget.RadioChoiceWidget(
@@ -187,8 +186,7 b' class WebhookIntegrationType(Integration'
187 186 handler = WebhookDataHandler(template_url, headers)
188 187
189 188 url_calls = handler(event, data)
190 log.debug('webhook: calling following urls: %s',
191 [x[0] for x in url_calls])
189 log.debug('webhook: calling following urls: %s', [x[0] for x in url_calls])
192 190
193 191 run_task(post_to_webhook, url_calls, self.settings)
194 192
@@ -202,37 +200,39 b' def post_to_webhook(url_calls, settings)'
202 200 'actor_ip': u'192.168.157.1',
203 201 'name': 'repo-push',
204 202 'push': {'branches': [{'name': u'default',
205 'url': 'http://rc.local:8080/hg-repo/changelog?branch=default'}],
206 'commits': [{'author': u'Marcin Kuzminski <marcin@rhodecode.com>',
207 'branch': u'default',
208 'date': datetime.datetime(2017, 11, 30, 12, 59, 48),
209 'issues': [],
210 'mentions': [],
211 'message': u'commit Thu 30 Nov 2017 13:59:48 CET',
212 'message_html': u'commit Thu 30 Nov 2017 13:59:48 CET',
213 'message_html_title': u'commit Thu 30 Nov 2017 13:59:48 CET',
214 'parents': [{'raw_id': '431b772a5353dad9974b810dd3707d79e3a7f6e0'}],
215 'permalink_url': u'http://rc.local:8080/_7/changeset/a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf',
216 'raw_id': 'a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf',
217 'refs': {'bookmarks': [], 'branches': [u'default'], 'tags': [u'tip']},
218 'reviewers': [],
219 'revision': 9L,
220 'short_id': 'a815cc738b96',
221 'url': u'http://rc.local:8080/hg-repo/changeset/a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf'}],
222 'issues': {}},
203 'url': 'http://rc.local:8080/hg-repo/changelog?branch=default'}],
204 'commits': [{'author': u'Marcin Kuzminski <marcin@rhodecode.com>',
205 'branch': u'default',
206 'date': datetime.datetime(2017, 11, 30, 12, 59, 48),
207 'issues': [],
208 'mentions': [],
209 'message': u'commit Thu 30 Nov 2017 13:59:48 CET',
210 'message_html': u'commit Thu 30 Nov 2017 13:59:48 CET',
211 'message_html_title': u'commit Thu 30 Nov 2017 13:59:48 CET',
212 'parents': [{'raw_id': '431b772a5353dad9974b810dd3707d79e3a7f6e0'}],
213 'permalink_url': u'http://rc.local:8080/_7/changeset/a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf',
214 'raw_id': 'a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf',
215 'refs': {'bookmarks': [],
216 'branches': [u'default'],
217 'tags': [u'tip']},
218 'reviewers': [],
219 'revision': 9L,
220 'short_id': 'a815cc738b96',
221 'url': u'http://rc.local:8080/hg-repo/changeset/a815cc738b9651eb5ffbcfb1ce6ccd7c701a5ddf'}],
222 'issues': {}},
223 223 'repo': {'extra_fields': '',
224 'permalink_url': u'http://rc.local:8080/_7',
225 'repo_id': 7,
226 'repo_name': u'hg-repo',
227 'repo_type': u'hg',
228 'url': u'http://rc.local:8080/hg-repo'},
224 'permalink_url': u'http://rc.local:8080/_7',
225 'repo_id': 7,
226 'repo_name': u'hg-repo',
227 'repo_type': u'hg',
228 'url': u'http://rc.local:8080/hg-repo'},
229 229 'server_url': u'http://rc.local:8080',
230 230 'utc_timestamp': datetime.datetime(2017, 11, 30, 13, 0, 1, 569276)
231 }
232 """
231 233
232 """
233 234 call_headers = {
234 'User-Agent': 'RhodeCode-webhook-caller/{}'.format(
235 rhodecode.__version__)
235 'User-Agent': 'RhodeCode-webhook-caller/{}'.format(rhodecode.__version__)
236 236 } # updated below with custom ones, allows override
237 237
238 238 auth = get_auth(settings)
@@ -247,8 +247,7 b' def post_to_webhook(url_calls, settings)'
247 247 headers = headers or {}
248 248 call_headers.update(headers)
249 249
250 log.debug('calling Webhook with method: %s, and auth:%s',
251 call_method, auth)
250 log.debug('calling Webhook with method: %s, and auth:%s', call_method, auth)
252 251 if settings.get('log_data'):
253 252 log.debug('calling webhook with data: %s', data)
254 253 resp = call_method(url, json={
General Comments 0
You need to be logged in to leave comments. Login now