L'API Google Tasks est maintenant disponible. Vous pouvez obtenir une liste de vos tâches via une requête HTTP, résultat renvoyé dans JSON. Il y a une étape par exemple étape sur la façon d'écrire un Google Tasks webapp sur Google App Engine à
http://code.google.com/appengine/articles/python/getting_started_with_tasks_api.html
L'échantillon webapp ressemble à ceci:
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)
Notez que vous devez d'abord activer API Google Tasks sur la console API https://code.google.com/apis/console/b/0/?pli=1
Peut-être. Qu'avez-vous essayé? Désolé SO n'est pas un moteur 'requirements => code'. –
J'ai essayé de faire un script greasmonkey/jquery qui .hide() toutes les divs de calendrier inutiles, mais je n'aime pas cette solution (son fragile). J'ai essayé de regarder le code google-calendar js, pour comprendre l'appel ajax, mais c'était trop compliqué. S'il y a un moyen plus simple/propre d'accéder à mes données ce serait génial. – ideotop