Exemple #1
0
from dropbox import client, rest, session

APP_KEY = 'ij4b7rjc7tsnlj4'
APP_SECRET = '00evf045y00ml2e'
ACCESS_TYPE = 'dropbox'
SDK_VERSION = "2.0"

# check if I specified app_key and app_secret
if APP_KEY == '' or APP_SECRET == '':
    exit(' x You need to set your APP_KEY and APP_SECRET!')

############### read settings, get things done #
################################################
###############################################

configurationDirectory = common.getConfigurationDirectory()

dropboxPath = common.getDropboxPath()
accountUID = common.getAccountUID()
notifier = common.getNotifier()

delta_switch = 0
STATE_FILE = normpath(configurationDirectory + '/search_cache.json')


################### initialize Dropbox session #
################################################
###############################################
# a wrapper around DropboxSession that stores a token to a file on disk
# (from Dropbox cli_client.py example)
class StoredSession(session.DropboxSession):
import sys, os, shutil
from orphilia import common
from ConfigParser import SafeConfigParser

home = os.path.expanduser("~")

# set configurationDirectory path dependent from platform
configurationDirectory = common.getConfigurationDirectory()


def config():
    # remove old settings
    if os.path.isdir(configurationDirectory):
        shutil.rmtree(configurationDirectory)

        # create directory
    os.makedirs(configurationDirectory)
    print(
        "Welcome to Orphilia, an open-source crossplatform Dropbox client.\nIn few steps, you will configure your Dropbox account to be used with Orphilia."
    )

    # initialize config parser
    config = SafeConfigParser()
    config.read(configurationDirectory + "/config.ini")

    # make sure sections are there
    config.add_section("main")
    config.add_section("notifications")

    # if we're on Haiku, we'd like to use that cool script which pushes notifications to desktop
    if sys.platform[:5] == "haiku":