Skip to content

About

Building services to increase user access and control over personal data and information. (the mozilla/ mirror is READ ONLY, synchronized from mercurial)

Resources

Stars

1 star

Watchers

2 watching

Forks

 
 

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

weaveclient-python

Weave Sync/Firefox Sync client library written in Python.

Features

  • Compatible with Weave Sync v1.1 (pre Firefox 29) an v1.5 (FxA)
  • Encrypt/Decrypt data stored on Weave Sync server (read and write)
  • Commandline client

Installation

Clone the repository and install the following module dependencies

Note: At the time of writing the Mozilla modules were not stable and hence to use weaveclient-python with the least grief it is recommended that a virtualenv is used so as to be able to install the latest dev versions of the mozilla modules.

Mozilla

  • PyFxA
  • PyBrowserID
  • PyHawk

Other

  • cryptography
  • M2Crypto
  • requests

Usage

Library

import weaveclient as wc

wc_params = {
    'api_version':    "V1_5",
    'account_server': "https://api.accounts.firefox.com",
    'token_server':   "https://token.services.mozilla.com",
    'username':       "username",
    'password':       "password"
}

weave_client = wc.WeaveClient.get_instance(wc_params)

collection = "bookmarks";

colWbo = weave_client.get_collection(collection)
for wbo in colWbo:
    if len(wbo['payload']) > 0:
       print wbo['payload']

id = "FprxRkbQsyKe" #Base64 encoded object id (unique within collection)
wbo = weave_client.get(collection, id)
if len(wbo['payload']) > 0:
   print wbo['payload']

Commandline

Usage: weaveclient [options]

Options:
  -h, --help            show this help message and exit
  -s ACCOUNT_SERVER, --account-server=ACCOUNT_SERVER
                        account server url if you are not using defaults
  -t TOKEN_SERVER, --token-server=TOKEN_SERVER
                        sync token server url if you are not using defaults
  -u USERNAME, --user=USERNAME
                        username
  -p PASSWORD, --password=PASSWORD
                        password (sent securely to server)
  -k SYNCKEY, --synckey=SYNCKEY
                        synckey (used locally)
  -K CREDENTIALFILE, --credentialfile=CREDENTIALFILE
                        get username, password, and synckey from this
                        credential file (as name=value lines)
  -c COLLECTION, --collection=COLLECTION
                        collection
  -i ID, --id=ID        object ID
  -f FORMAT, --format=FORMAT
                        format (json|xml|text). Defaults to json
  -v API_VERSION, --api-version=API_VERSION
                        weave sync storage api version (V1_1|V1_5). Defaults
                        to V1_1
  -l LOGLEVEL, --log-level=LOGLEVEL
                        set log level (critical|error|warn|info|debug).
                        Defaults to info
  -m MODIFY, --modify=MODIFY
                        Update collection, or single item, with given value in
                        JSON format. Requires -c and optionally -i
  --plaintext           plaintext collection, don't decrypt
  --test-mode           use test data

Note: To run weaveclient from an alternative python installation, i.e. a virtualenv, use the PYTHON_BIN environment variable, e.g.:

$ PYTHON_BIN=path/to/alternative/python weaveclient

About

Building services to increase user access and control over personal data and information. (the mozilla/ mirror is READ ONLY, synchronized from mercurial)

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages