Created
February 8, 2012 23:35
-
-
Save jorilallo/1775440 to your computer and use it in GitHub Desktop.
BitBucket
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib | |
| from brokers import BaseBroker | |
| from django.utils import simplejson as sj | |
| class URLOpener(urllib.FancyURLopener): | |
| version = 'bitbucket.org' | |
| class Post(BaseBroker): | |
| def handle(self, payload): | |
| api_key = payload['service']['channel_token'] | |
| url = 'https://grove.io/api/services/bitbucket/%s/' % api_key | |
| del payload['service'] | |
| del payload['broker'] | |
| # Identify the call origin from BitBucket | |
| payload['service'] = 'bitbucket' | |
| post_load = { 'payload': sj.dumps(payload) } | |
| opener = self.get_local('opener', URLOpener) | |
| opener.open(url, urllib.urlencode(post_load)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment