Deployr python client
First version of a simple python client for deployr.
Usage:
- Install
$ pip install deployrclient
$ pip install deployrclient
- Create instance and configure
from deployr_connection import DeployRConnection
host = "http://your.host.com:port/deployr/"
deployr_connection = DeployRConnection(host)
- Login
deployr_connection.login("username", "Passw0rd")
- Create project
data = {"projectname": "some name", "projectdescr": "some description"}
status_response, response = deployr_connection.call_api("r/project/create/", data)
- Execute script
data = {"project": "your project identifier", "filename": "source.R", "directory": "home", "author": "your_author"}
status_response, response = deployr_connection.call_api("r/project/execute/script/", data)
- Upload files to project working directory
data = {"project": "your project identifier", "filenam": "your_file_name.ext", "descr": "your file description", "overwrite": True}
files = {"file": file_content} # file content could be 'open("/url/file.ext", 'rb').read()'
status_response, response = deployr_connection.call_api("r/project/directory/upload/", data, files=files)
- Add rinputs
deployr_connection.set_rinput("variable", "primitive", 123456)
- Add routputs
deployr_connection.set_routput("variable")