yaq/daemons/gdrive


Upload files to a specified google drive folder

external links

source
bugtracker

installation

The gdrive daemon can be installed using the following package managers:

PyPI

traits

The gdrive daemon is composed of the following traits:

is-daemon

configuration

client_secret (string)

client_id (string)

root_folder_id (string)

scopes ([string]) default: ['https://www.googleapis.com/auth/drive.file']

authorization_url (string) default: https://accounts.google.com/o/oauth2/v2/auth

token_url (string) default: https://www.googleapis.com/oauth2/v4/token

create_file_url (string) default: https://www.googleapis.com/upload/drive/v3/files

generate_ids_url (string) default: https://www.googleapis.com/drive/v3/files/generateIds

update_file_url (string) default: https://www.googleapis.com/upload/drive/v3/files/{file_id}

download_url (string) default: https://drive.google.com/uc?id={file_id}

open_url (string) default: https://drive.google.com/open?id={file_id}

port (integer)
TCP port for daemon to occupy.
from is-daemon

serial (string) default: NULL
Serial number for the particular device represented by the daemon
from is-daemon

make (String) default: NULL
from is-daemon

model (String) default: NULL
from is-daemon

state

The gdrive daemon will provide the following state information:

access_token
type: string

refresh_token
type: string

upload_queue
type: [[string*5], ...]

copy_queue
type: [[string*5], ...]

id_mapping
type: {string: string, ...}

methods

Daemons with the gdrive trait expose the following public methods:

reserve_id ➜ string
Insert an id mapping into the state
Arguments:

client_id, {'type': 'string'}

drive_id, {'type': 'string', 'default': 'NULL', 'description': 'If not given use an existing id if possible or retrieve a new one.'}

id_to_open_url ➜ string
Format an id in a url suitable to open the file.
Arguments:

id_, {'type': 'string'}

id_to_download_url ➜ string
Format an id in a url suitable to download the file.
Arguments:

id_, {'type': 'string'}

create_folder
Create a new folder in the remote drive
Arguments:

path, {'type': 'string'}

parent_id, {'type': 'string', 'default': 'NULL'}

id_, {'type': 'string', 'default': 'NULL'}

upload_folder
Upload a folder and its contents, recursively, to the remote drive
Arguments:

path, {'type': 'string'}

parent_id, {'type': 'string', 'default': 'NULL'}

id_, {'type': 'string', 'default': 'NULL'}

create_file
Create a new file on the remote drive
Arguments:

path, {'type': 'string'}

parent_id, {'type': 'string', 'default': 'NULL'}

id_, {'type': 'string', 'default': 'NULL'}

update_file
Update the contents of an existing file
Arguments:

path, {'type': 'string'}

id_, {'type': 'string', 'default': 'NULL'}

is_uploaded ➜ boolean
Check if a particular file has been procesed and uploaded
Arguments:

id_, {'type': 'string'}

busy ➜ boolean
Returns true if daemon is currently busy.
from is-daemon

id ➜ dictionary
JSON object with information to identify the daemon, including name, kind, make, model, serial.
from is-daemon

get_config_filepath ➜ string
String representing the absolute filepath of the configuration file on the host machine.
from is-daemon

get_config ➜ dictionary
Full configuration for the individual daemon as defined in the TOML file. This includes defaults and shared settings not directly specified in the daemon-specific TOML table.
from is-daemon

get_traits ➜ [string]
Get a full list of the daemon traits.
from is-daemon

get_state ➜ dictionary
Get daemon state, as saved in the state.toml file.
from is-daemon

set_state
Set daemon state. Accepts any subset of the state dictionary, dynamically.
from is-daemon

list_methods ➜ [string]
Get an array of all known public method names.
from is-daemon

shutdown
Cleanly shutdown daemon.
from is-daemon

help ➜ string
If method not given, return a human-readable string with information about the daemon as a whole. If method is given, return a human-readable string with the signature of the method on the first line and a description of the method on subsequent lines. The signature is not specified to be in any particular language. It is intended for usage by humans ONLY.
from is-daemon
Arguments:

method, {'type': 'string'}