summaryrefslogtreecommitdiff
path: root/src/leap/soledad/client/examples/soledad_sync.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-06-26 16:48:40 +0200
committerKali Kaneko <kali@leap.se>2017-06-26 16:48:40 +0200
commita653032662c990c662bf6706b0784bce1c553cbd (patch)
treebd126e8d3614f6a29f055c89e0546108b4aefc1f /src/leap/soledad/client/examples/soledad_sync.py
parent80699961145de3941c645ab3d8f3a4f9c2775ef3 (diff)
[pkg] move examples folder to docs/
Diffstat (limited to 'src/leap/soledad/client/examples/soledad_sync.py')
-rw-r--r--src/leap/soledad/client/examples/soledad_sync.py63
1 files changed, 0 insertions, 63 deletions
diff --git a/src/leap/soledad/client/examples/soledad_sync.py b/src/leap/soledad/client/examples/soledad_sync.py
deleted file mode 100644
index 3aed10eb..00000000
--- a/src/leap/soledad/client/examples/soledad_sync.py
+++ /dev/null
@@ -1,63 +0,0 @@
-from leap.bitmask.config.providerconfig import ProviderConfig
-from leap.bitmask.crypto.srpauth import SRPAuth
-from leap.soledad.client import Soledad
-from twisted.internet import reactor
-import logging
-logging.basicConfig(level=logging.DEBUG)
-
-
-# EDIT THIS --------------------------------------------
-user = u"USERNAME"
-uuid = u"USERUUID"
-_pass = u"USERPASS"
-server_url = "https://soledad.server.example.org:2323"
-# EDIT THIS --------------------------------------------
-
-secrets_path = "/tmp/%s.secrets" % uuid
-local_db_path = "/tmp/%s.soledad" % uuid
-cert_file = "/tmp/cacert.pem"
-provider_config = '/tmp/cdev.json'
-
-
-provider = ProviderConfig()
-provider.load(provider_config)
-
-soledad = None
-
-
-def printStuff(r):
- print r
-
-
-def printErr(err):
- logging.exception(err.value)
-
-
-def init_soledad(_):
- token = srpauth.get_token()
- print "token", token
-
- global soledad
- soledad = Soledad(uuid, _pass, secrets_path, local_db_path,
- server_url, cert_file,
- auth_token=token)
-
- def getall(_):
- d = soledad.get_all_docs()
- return d
-
- d1 = soledad.create_doc({"test": 42})
- d1.addCallback(getall)
- d1.addCallbacks(printStuff, printErr)
-
- d2 = soledad.sync()
- d2.addCallbacks(printStuff, printErr)
- d2.addBoth(lambda r: reactor.stop())
-
-
-srpauth = SRPAuth(provider)
-
-d = srpauth.authenticate(user, _pass)
-d.addCallbacks(init_soledad, printErr)
-
-reactor.run()