繁体   English   中英

调用Python API-Google App Engine

[英]Calling Python API - Google App Engine

对于使用从.JAR生成的API而言,我有些困惑,该API是使用我的Google App Engine的Python API生成的。

下面有一个示例和一个AsyncTask,用于在数据存储区中创建和存储事件实体。

您通常会使用请求/响应消息将数据传递给实体吗?

我有一个具有insert()方法的Event类,但是它不允许我将任何事件详细信息传递给它,因为它缺少诸如Request / Response类的任何设置方法/获取方法

private void sendResultToServer(String eventDesc, String eventName,
        String eventTime) {
    ImhotepApiMessagesEventRequest newEvent = new ImhotepApiMessagesEventRequest();
    newEvent.setEventDesc(eventDesc);
    newEvent.setEventTitle(eventName);
    newEvent.setEventTime(eventTime);
    new SendResultToServerTask().execute(newEvent, null, null);
}

/**
 * Handles the request to the Event Endpoint, to save a event, without
 * blocking the UI.
 */
private class SendResultToServerTask extends
        AsyncTask<ImhotepApiMessagesEventRequest, Void, Void> {

    @Override
    protected Void doInBackground(
            ImhotepApiMessagesEventRequest... params) {
        // TODO Auto-generated method stub
        service.event();
        return null;
    }

Java 使用数据存储区示例是使用 guestbook doPost处理程序创建自己的实体的良好起点。 在示例启动并运行之后,您可以将其扩展到“任务队列”。

Java使用推入队列中的第一个代码示例将命名参数添加到异步任务调用中。 根据Class TaskOptions,您可以链接.param(“ name”,“ value”)调用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM