def post(self, owner, repo): self.response.headers['Access-Control-Allow-Origin'] = '*' access_token = exchange_token(self) if access_token is None: return starred = util.github_request('user/starred', owner, repo, access_token=access_token, method='GET') # Check if repository is already starred if starred.status_code is 204: self.response.set_status(202) return util.github_request('user/starred', owner, repo, access_token=access_token, method='PUT') self.response.set_status(204)
def main(): parser = optparse.OptionParser() parser.add_option('-v', '--verbose', action='store_true') opts,args = parser.parse_args() util.ensureDir(GITHUB_EVENTS_DIR) io_loop = tornado.ioloop.IOLoop() pc = tornado.ioloop.PeriodicCallback( lambda: util.github_request('/events?per_page=100', functools.partial(handle_request, datetime.datetime.utcnow(), opts), io_loop=io_loop), INTERVAL, io_loop=io_loop) pc.start() io_loop.start()
def main(): io_loop = tornado.ioloop.IOLoop() util.github_request('/', functools.partial(handle_request, io_loop), io_loop) io_loop.start()