def run(config): """ Gets the revisions for a given dropbox file. If set, produces the revs in different formats. """ # Get client client, config = authutils.build_client(config) # Get the remote path for the given file remote_path = pathutils.find_remote_db_path(config.get("local_file")) # Now get the revisions of the given file revs = client.revisions(remote_path) # Which revision to use? revVal = __get_rev(revs, config) # Get the formatter function formatter = __get_formatter(config.get("formatter")) # TODO Needs a way to control where to send output output = formatter(revVal) if config.get("output"): __do_output(output, config) return output
def run(config): """ Gets the revisions for a given dropbox file. If set, produces the revs in different formats. """ # Get client client, config = auth.build_client(config) # Get the remote path for the given file remote_path = pathutils.find_remote_db_path(config.get("local_file")) # Now get the revisions of the given file revs = client.revisions(remote_path) # Which version to use? revVal = __get_rev(revs, config) # Get the formatter function formatter = __get_formatter(config.get("format")) # TODO Needs a way to control where to send output output = formatter(revVal) __do_output(output, config) return output
def run(config): """ Puts file into destination within Dropbox """ # Get client client, config = auth.build_client(config) local_path = config.get("local_file") dest_path = pathutils.find_remote_db_path(config.get("dest")) put_file = __do_put(local_path, dest_path, client, config) return put_file
def run(config): """ Gets a copy of the file from dropbox store. If specified gets """ # Get client client, config = auth.build_client(config) # Get the remote path for the given file remote_path = pathutils.find_remote_db_path(config.get("local_file")) get_file = __do_output(remote_path, client, config) return get_file
def run(config): """ Gets a copy of the file from dropbox store. If specified gets """ # Get client client, config = authutils.build_client(config) # Get the remote path for the given file # TODO Might need a check if `local_file` is a dir remote_path = pathutils.find_remote_db_path(config.get("local_file")) try: get_file = __do_output(remote_path, client, config) except dbrest.ErrorResponse as err: msg = { "local_file": config.get("local_file"), "remote_path": remote_path, "body": err.body, "message": err.message, } __log__.exception("Failed to output file! Error: {}".format(msg)) return get_file