示例#1
0
 def get_repositories_events(self, repository_list):
     repo_events = []
     request_urls = []
     url_requests = []
     for repo in repository_list:
         request_urls.append('https://api.bitbucket.org/1.0/repositories/%s/%s/events/'%(repo.owner.lower(),repo.name.lower()))
     for url in request_urls:
         url_requests.append(get_events.delay(url))
     for url_request in url_requests:
         get = url_request.get()
         if get is not None:
             repo_events.extend(get['events'][:30])
     repo_events = sorted(repo_events,key=itemgetter('created_on'), reverse = True)[:30]
     return repo_events
 def get_repositories_events(self, repository_list):
     repo_events = []
     request_urls = []
     url_requests = []
     for repository in repository_list:
         slug = '/'.join((repository.owner, repository.name))
         request_urls.append(GithubProvider.base_url + 'repos/' + slug + '/events' + '?client_id=' + settings.GITHUB_APP_ID + '&client_secret=' + settings.GITHUB_API_SECRET)
     for url in request_urls:
         url_requests.append(get_events.delay(url))
     for url_request in url_requests:
         get = url_request.get()
         if get is not None:
             repo_events.extend(get[:30])
     repo_events = sorted(repo_events, key=itemgetter('created_at'), reverse = True)[:30]
     return repo_events