Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Desarrollando aplicaciones con Ubuntu One

Desarrollando aplicaciones con Ubuntu One

Charla dada en UbuconLA el 3/6/2012

Roberto Alsina

June 04, 2012
Tweet

More Decks by Roberto Alsina

Other Decks in Programming

Transcript

  1. Qué es Ubuntu One • Servicio de storage online •

    File sync • Music Store / Music Streaming • U1DB 2
  2. Autorización en Ubuntu Usando ubuntuone.platform.credentials: @defer.inlineCallbacks def get_credentials(): tool =

    CredentialsManagementTool() creds = yield tool.register() oauth_consumer = oauth2.Consumer( creds['consumer_key'], creds['consumer_secret']) oauth_token = oauth2.Token( creds['token'], creds['token_secret']) 6
  3. Autorización en Django OAuth 1.0a. Usando django_oauth_client: @oauth_token_required('ubuntuone') def create_volume(request):

    client = get_client(request.user, 'ubuntuone') response, content = client.request( 'https://one.ubuntu.com/api/file_storage/v1/volumes/~/Shoreham', 'PUT') return redirect('/accounts/profile/') 7
  4. En Websites @oauth_token_required('ubuntuone') def create_volume(request): client = get_client(request.user, 'ubuntuone') response,

    content = client.request( 'https://one.ubuntu.com/api/file_storage/v1/volumes/~/Shoreham', 'PUT') return redirect('/accounts/profile/') 10
  5. Plataformas • Ubuntu/Windows/OS X - Python - SQLite • Ubuntu

    - Vala - SQLite • Ubuntu/Windows/OS X - C - SQLite • Web - javascript - localStorage • Android - Java - SQLite • iOS - Objective-C - SQLite 13
  6. Crear Índices {"firstname": "John", "surname", "Barnes", "position": "left wing"} ID

    jb {"firstname": "Jan", "surname", "Molby", "position": "midfield"} ID jm {"firstname": "Alan", "surname", "Hansen", "position": "defence"} ID ah {"firstname": "John", "surname", "Wayne", "position": "filmstar"} ID jw create_index("by-firstname", ["firstname"]) 16
  7. Ejemplo import json, u1db db = u1db.open(":memory:", create=True) doc1 =

    db.create_doc(json.dumps({"key": "value"}), doc_id="testdoc1") doc2 = db.create_doc(json.dumps({"key": "value"}), doc_id="testdoc2") for doc in db.get_docs(["testdoc2","testdoc1"]): print doc.doc_id Resultado: testdoc1 testdoc2 19