Ejemplo n.º 1
0
    def post(self):
        data = json.loads(self.request.body)
        uuid = data.get('uuid')
        if networkutil.isUuidHandled(uuid):
            message = 'HeadlineAddResponse: %s is already handled.' % (uuid, )
            logging.warn(message)
            self.response.out.write(message)
            return
        networkutil.updateUuids(uuid)

        rawdata = self.request.body
        taskqueue.add(queue_name="default", payload=rawdata, url='/words/add/')
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Request is accepted.')
Ejemplo n.º 2
0
    def post(self):
        data = json.loads(self.request.body)
        uuid = data.get('uuid')
        if networkutil.isUuidHandled(uuid):
            message = 'FetchRequest: %s is already handled.' % (uuid, )
            logging.warn(message)
            self.response.out.write(message)
            return
        networkutil.updateUuids(uuid)

        rawdata = self.request.body
        taskqueue.add(queue_name="default",
                      payload=rawdata,
                      url='/fetch/batch/')
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Request is accepted.')
Ejemplo n.º 3
0
    def post(self):
        data = json.loads(self.request.body)
        uuid = data.get('uuid')
        if networkutil.isUuidHandled(uuid):
            message = 'PosterResponse: %s is already handled.' % (uuid, )
            logging.warn(message)
            self.response.out.write(message)
            return
        networkutil.updateUuids(uuid)

        rawdata = self.request.body
        # Use queue so we have a longer deadline.
        taskqueue.add(queue_name='default',
                      payload=rawdata,
                      url='/poster/response/')
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Request is accepted.')
Ejemplo n.º 4
0
    def post(self):
        data = json.loads(self.request.body)
        uuid = data.get('uuid')
        if networkutil.isUuidHandled(uuid):
            message = 'WordsRequest: %s is already handled.' % (uuid, )
            logging.warn(message)
            self.response.out.write(message)
            return
        networkutil.updateUuids(uuid)

        sourceapp = self.request.headers.get('app')
        if sourceapp:
            key = sourceapp + '.' + data['key']
        else:
            key = data['key']
        models.saveWordsRequest(key, data)
        backendsData = json.dumps({'key': key})
        taskqueue.add(queue_name="words", payload=backendsData, url='/backends/run/')
        self.response.headers['Content-Type'] = 'text/plain'
        message = 'Request for %s is accepted.' % (key, )
        logging.info(message)
        self.response.out.write(message)