0

Gmail とタスク API はどこでも利用できるわけではないため (例: 一部の企業は Gmail をブロックしているがカレンダーはブロックしていない)、カレンダーの Web インターフェイスを介して Google タスクを破棄する方法はありますか?

以下のようなユーザースクリプトを作成しましたが、脆弱すぎることがわかりました。

// List of div to hide
idlist = [
    'gbar',
    'logo-container',
    ...
];

// Hiding by id
function displayNone(idlist) {
    for each (id in idlist) {
        document.getElementById(id).style.display = 'none';
    }
}
4

2 に答える 2

1

Google Tasks API が利用できるようになりました。HTTP クエリを介してタスクのリストを取得でき、結果は JSON で返されます。Google App Engine で Google Tasks Web アプリケーションを作成する方法の段階的な例が次の URL にあります。

http://code.google.com/appengine/articles/python/getting_started_with_tasks_api.html

サンプル Web アプリケーションは次のようになります。

from google.appengine.dist import use_library
use_library('django', '1.2')
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
from apiclient.discovery import build
import httplib2
from oauth2client.appengine import OAuth2Decorator
import settings

decorator = OAuth2Decorator(client_id=settings.CLIENT_ID,
                            client_secret=settings.CLIENT_SECRET,
                            scope=settings.SCOPE,
                            user_agent='mytasks')


class MainHandler(webapp.RequestHandler):

  @decorator.oauth_aware
  def get(self):
    if decorator.has_credentials():
      service = build('tasks', 'v1', http=decorator.http())
      result = service.tasks().list(tasklist='@default').execute()
      tasks = result.get('items', [])
      for task in tasks:
        task['title_short'] = truncate(task['title'], 26)
      self.response.out.write(template.render('templates/index.html',
                                              {'tasks': tasks}))
    else:
      url = decorator.authorize_url()
      self.response.out.write(template.render('templates/index.html',
                                              {'tasks': [],
                                               'authorize_url': url}))


def truncate(string, length):
  return string[:length] + '...' if len(string) > length else string

application = webapp.WSGIApplication([('/', MainHandler)], debug=True)


def main():
  run_wsgi_app(application)

まず、API コンソールhttps://code.google.com/apis/console/b/0/?pli=1で Google Tasks API を有効にする必要があることに注意してください。

于 2011-09-09T10:16:16.803 に答える
0

見たいカレンダーのAtomフィードを解析することをお勧めします。個々のカレンダーのフィードを取得するには、[オプション]歯車> [カレンダー設定]を選択し、[カレンダー]タブを選択して、目的のカレンダーを選択します。[カレンダーの詳細]画面から、At​​om(XML)フィード、iCalフィード、またはHTML/Javascriptカレンダーを取得できます。

于 2011-03-21T13:39:43.777 に答える