def get(self): logging.info('Checking versions...') start = time.time() # Set starting point for timing. repo = "gustavnikolaj/version.is-sources" repo_url = "https://api.github.com/repos/" + repo + "/contents" repo_data = json.loads(urlfetch.fetch(repo_url).content) for project in repo_data: shacache_all = ShaCache.all() # Have to be called on each loop, otherwise it will not reset the filters name = project['name'].replace('.json', '') if name != 'README.md': # Dont try to do work with the README.md file :-) sha = project['sha'] # If no cache record for the file exists, it means that it's either new or changed. Refresh! if shacache_all.filter('project =', name).filter('sha =', sha).count() == 0: refreshProjectCache(name, sha) # Load data from cache... data = loadProjectData(name) # Check if the specified handler is indeed a valid handler. h = testHandler(data['handler']['handler']) # Log the response. if h[0]: version = h[1](name, data['handler']) logging.info('Current version of ' + data['project'] + ' is ' + version) memcache.set('version:' + name, version) else: logging.error('Could not get version info about ' + data['project'] + ': invalid handler specified.') exectime = "{0:.3f}".format(time.time() - start) # Calculate execution time. response = 'Task finished in ' + str(exectime) + ' seconds.' # Format execution time. logging.info(response) # Log it. self.response.write(response + ' Check logs for details.') # Print it. Reference to Log for details.