def getChanges(request, options=None):
 payload = json.loads(request.args['payload'][0])
 repo_url = ('%s%s' % (payload['canon_url'], payload['repository']['absolute_url']))
 project = request.args.get('project', [''])[0]
 changes = []
 for commit in payload['commits']:
  changes.append({'author': commit['raw_author'], 'files': [f['file'] for f in commit['files']], 'comments': commit['message'], 'revision': commit['raw_node'], 'when_timestamp': dateparse(commit['utctimestamp']), 'branch': commit['branch'], 'revlink': ('%scommits/%s' % (repo_url, commit['raw_node'])), 'repository': repo_url, 'project': project})
  log.msg(('New revision: %s' % (commit['node'],)))
 log.msg(('Received %s changes from bitbucket' % (len(changes),)))
 return (changes, payload['repository']['scm'])

def getChanges ( request , options = None ) : payload = json . loads ( request . args [ 'payload' ] [ 0 ] ) repo_url = ( '%s%s' % ( payload [ 'canon_url' ] , payload [ 'repository' ] [ 'absolute_url' ] ) ) project = request . args . get ( 'project' , [ '' ] ) [ 0 ] changes = [ ] for commit in payload [ 'commits' ] : changes . append ( { 'author' : commit [ 'raw_author' ] , 'files' : [ f [ 'file' ] for f in commit [ 'files' ] ] , 'comments' : commit [ 'message' ] , 'revision' : commit [ 'raw_node' ] , 'when_timestamp' : dateparse ( commit [ 'utctimestamp' ] ) , 'branch' : commit [ 'branch' ] , 'revlink' : ( '%scommits/%s' % ( repo_url , commit [ 'raw_node' ] ) ) , 'repository' : repo_url , 'project' : project } ) log . msg ( ( 'New revision: %s' % ( commit [ 'node' ] , ) ) ) log . msg ( ( 'Received %s changes from bitbucket' % ( len ( changes ) , ) ) ) return ( changes , payload [ 'repository' ] [ 'scm' ] )
reponds only to post events and starts the build process :arguments: request the http request object .