Ejemplo n.º 1
0
import tornado.web

import json

from pivotal import Pivotal

#
# set up interface to Pivotal
#
token = os.getenv('PIVOTAL_TOKEN')
if not token:
    msg = 'Please provide your Pivotal API token via an environment variable: PIVOTAL_TOKEN\n' \
          'Your API Token can be found on your Profile page: https://www.pivotaltracker.com/profile'
    raise RuntimeError(msg)

pivotal = Pivotal(project='1885757', token=token)


class GitHubHandler(tornado.web.RequestHandler):
    def get(self):
        """
        Receive and process a message from GitHub
        """
        self.write("Well, Hello there!")

    def post(self):
        """
        Receive and process a message from GitHub
        """
        print('--------------------------------------')
        print('POST received:', self.request.headers.get('X-GitHub-Event'))