I am currently working from home, and I have a python script on my laptop that I would like to run, that has to access data from a remote server, that I can access via ssh. Is there a way to do this?
I cannot copy my script onto the server unfourtunately, because there is no disk space on there right now.
I think you should be able to open an SSH connection with paramiko.
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('serveraddress', username='you', password='pass')
# DO python stuff here
# When you need a csv data - example SFTP
# sftp = ssh.open_sftp()
# fpath= '/path/to/data.csv'
# remote_file = sftp.open(fpath)
# import pandas as pd
# df = pd.read_csv(remote_file)
remote_file.close()
sftp.close()
ssh.close()