def add_hook(self, save=True): if self.user_settings: connect = GitHubClient(external_account=self.external_account) secret = utils.make_hook_secret() hook = connect.add_hook( self.user, self.repo, 'web', { 'url': urljoin( hook_domain, os.path.join(self.owner.api_url, 'github', 'hook/')), 'content_type': github_settings.HOOK_CONTENT_TYPE, 'secret': secret, }, events=github_settings.HOOK_EVENTS, ) if hook: self.hook_id = hook.id self.hook_secret = secret if save: self.save()
def add_hook_to_old_node_settings(document, account): connect = GitHubClient(external_account=account) secret = make_hook_secret() hook = None try: hook = connect.add_hook( document['user'], document['repo'], 'web', { 'url': urlparse.urljoin( HOOK_DOMAIN, os.path.join( Node.load(document['owner']).api_url, 'github', 'hook/')), 'content_type': github_settings.HOOK_CONTENT_TYPE, 'secret': secret, }, events=github_settings.HOOK_EVENTS, ) except ApiError: pass if hook: database['addongithubnodesettings'].find_and_modify( {'_id': document['_id']}, {'$set': { 'hook_id': hook.id, 'hook_secret': secret }})
def add_hook(self, save=True): if self.user_settings: connect = GitHubClient(external_account=self.external_account) secret = utils.make_hook_secret() hook = connect.add_hook( self.user, self.repo, 'web', { 'url': urlparse.urljoin( hook_domain, os.path.join( self.owner.api_url, 'github', 'hook/' ) ), 'content_type': github_settings.HOOK_CONTENT_TYPE, 'secret': secret, }, events=github_settings.HOOK_EVENTS, ) if hook: self.hook_id = hook.id self.hook_secret = secret if save: self.save()
def add_hook_to_old_node_settings(document, account): connect = GitHubClient(external_account=account) secret = make_hook_secret() hook = None try: hook = connect.add_hook( document['user'], document['repo'], 'web', { 'url': urlparse.urljoin( HOOK_DOMAIN, os.path.join( Node.load(document['owner']).api_url, 'github', 'hook/' ) ), 'content_type': github_settings.HOOK_CONTENT_TYPE, 'secret': secret, }, events=github_settings.HOOK_EVENTS, ) except ApiError: pass if hook: database['addongithubnodesettings'].find_and_modify( {'_id': document['_id']}, { '$set': { 'hook_id': hook.id, 'hook_secret': secret } } )