A simple tool for developers to perform operations on server with just a few line of codes.
pip i server_connector
Before you perform operations on server, you need to initialize a ServerConnector object
:
from server_connector import server
server_info = {
"ip": "your server ip",
"username": "xxx",
"password": "xxx"
}
sc = server.ServerConnector(server_info)
Upload a file from client to server.
sc.uploadFile("./xxx.txt", "/<directory>/xxx.txt")
Directory will be created recursively if it does not exist on server.
Download a file from server to client.
sc.downloadFile("/<directory>/xxx.txt", "./xxx.txt")
Delete a file from server.
sc.downloadFile("/path/to/your/file")
Upload a directory from client to server.
sc.uploadDir("./xxx", "/<directory>")
The xxx directory will be uploaded to /<directory>/xxx
on server.
Download a directory from server to client.
sc.downloadDir("/<directory>/xxx", "./")
Delete a directory from server.
sc.deleteDir("/path/to/your/directory")