コード例 #1
0
ファイル: handlersapi.py プロジェクト: sportlin/newsshow
    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.')
コード例 #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.')
コード例 #3
0
ファイル: handlersapi.py プロジェクト: politicslin/newsposter
    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.')
コード例 #4
0
ファイル: handlersapi.py プロジェクト: science2lin/newstrend
    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)