def test_get_url(): client = dropbox_client.get_client() assert json.loads(client.request('https://api.dropbox.com/1/account/info', 'GET')[1]) is not None
import logging import re import simplejson as json from google.appengine.api import memcache import yaml from dropbox_client import get_client # Dropbox API endpoints path_url = 'https://api-content.dropbox.com/1/files/sandbox' # don't add a `/`! metadata_url = 'https://api.dropbox.com/1/metadata/sandbox/' # Get a dropbox client (pickled) client = get_client() # helper to download a RESTFUL endpoint with the GET method. get = lambda x: client.request(x, 'GET')[1] # A sorting function for posts. Sorts by filename. path_fun = lambda x: x['path'] def get_posts(sort_key=path_fun): '''Returns posts as a sorted list. TODO: add caching ''' url = ''.join((metadata_url, 'posts')) logging.info('url is: %s' % url)
# -*- coding: utf-8 -*- import os import pprint try: from dropbox_client import get_client except: from site_packages.dropbox_client import get_client pp = pprint.PrettyPrinter(indent=4) APP_NAME = 'dmmmd sync' OVERWRITE = True NEWFILE = True client = get_client(APP_NAME) def dropbox_file_and_metadata(filepath): """returns a filelike object from filepath in dropbox""" result = client.get_file_and_metadata(filepath) return result def dropbox_files_and_metadata(download_filepaths): """returns a list of tuples of (dropbox file object, metadata)""" return [dropbox_file_and_metadata(filepath) for filepath in download_filepaths] class Metadata(object): """return an object with attrs""" local_root = 'pythonista'
import logging import re import simplejson as json from google.appengine.api import memcache import yaml from dropbox_client import get_client # Dropbox API endpoints path_url = "https://api-content.dropbox.com/1/files/sandbox" # don't add a `/`! metadata_url = "https://api.dropbox.com/1/metadata/sandbox/" # Get a dropbox client (pickled) client = get_client() # helper to download a RESTFUL endpoint with the GET method. get = lambda x: client.request(x, "GET")[1] # A sorting function for posts. Sorts by filename. path_fun = lambda x: x["path"] def get_posts(sort_key=path_fun): """Returns posts as a sorted list. TODO: add caching """ url = "".join((metadata_url, "posts"))
def test_get_url(): client = dropbox_client.get_client() assert json.loads(client.request("https://api.dropbox.com/1/account/info", "GET")[1]) is not None