簡體   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