Questions tagged [pysftp]

pysftp is a thin wrapper over paramiko's SFTPClient.

pysftp is a thin wrapper over 's SFTPClient.

372 questions
2
votes
1 answer

Download new files only, ignoring file extensions, from remote SFTP server in Python

from datetime import datetime import pysftp import fnmatch import os from stat import S_IMODE, S_ISDIR, S_ISREG Hostname = "Hostname" Username = "Username" Password = "Password" cnopts = pysftp.CnOpts() cnopts.hostkeys = None with…
Yamz
  • 23
  • 3
2
votes
1 answer

Using Python pysftp download files from SFTP and store directly in AWS S3

Using Python trying to download files from SFTP using pysftp module and save the files directly in S3 bucket. I should not save the files in my local. They should be directly saved into S3. I could not find an option to put the files directly in…
Villa
  • 126
  • 2
  • 9
2
votes
1 answer

sFTP with SSH Key & Password in Python

Trying to use pysftp to pull files from an sFTP server that requires both ssh key & password for authentication without much luck. Can use pysftp with just key and just password, but it breaks when I attempt to use both. Hoping someone has some…
Karo
  • 61
  • 6
2
votes
1 answer

How to take data from SFTP server without downloading files in my local storage in Python?

I have an SFTP server. I can take data by transferring/downloading files. Is there a way that I can do without downloading files? My code is as below: # Connection to the SFTP server with pysftp.Connection(hostname, username, passowrd, port) as…
Elvin Jafarov
  • 1,341
  • 11
  • 25
2
votes
1 answer

Read SHP file from SFTP using pysftp

I am trying to use pysftp's getfo() to read a shapefile (without downloading it). However the output I get does not seem workable and I'm not sure if its possible do this with a shapefile. Ideally I would like to read in the file and convert it to a…
jtownsend
  • 55
  • 4
2
votes
1 answer

How to upload all files from Windows folder to SFTP folder in Python

I am trying to upload all the files in my Windows folder to SFTP folder. Below is my code. If there are no files in csv folder, nothing should happen. How to achieve this? with pysftp.Connection(host, username, password) as sftp: localpath =…
massu1000
  • 209
  • 2
  • 10
2
votes
1 answer

How to get last modified time from pysftp

I am using pysftp to access files on SFTP. But I want to get the last modified date of these files and store it in mongo. This is to access the date again next time I run the code. I cannot find a function that returns me the date of the file. class…
2
votes
1 answer

Is it possible to specify the encoding of a file with Paramiko?

I'm trying to read a CSV over SFTP using pysftp/Paramiko. My code looks like this: input_conn = pysftp.Connection(hostname, username, password) file = input_conn.open("Data.csv") file_contents = list(csv.reader(file)) But when I do this, I get the…
2
votes
1 answer

pysftp Paramiko PasswordRequiredException: Private key file is encrypted

When connecting to an SFTP server with the following code I am getting the error below. from base64 import decodebytes import pysftp from paramiko import RSAKey host = 'where_it_should_be' username = 'thename' private_key = 'private_key' keydata…
Daniel Butler
  • 3,239
  • 2
  • 24
  • 37
2
votes
2 answers

Error trying to import pysftp in Lambda: cannot import name '_bcrypt' from partially initialized module 'bcrypt' (most likely due to circular import)

I'm trying to import pysftp in my AWS lambda function, but I'm getting this error: "Unable to import module 'app': cannot import name '_bcrypt' from partially initialized module 'bcrypt' (most likely due to a circular import)" The only code I have…
sfroonj
  • 21
  • 1
  • 3
2
votes
1 answer

Optimize the performance of retreiving file sizes with pysftp

I have a requirement to get the file details for certain locations (within the system and SFTP) and get the file size for some locations on SFTP which can be achieved using the shared code. def getFileDetails(location: str): filenames: list =…
cyrvp
  • 33
  • 4
2
votes
2 answers

pysftp throwing paramiko.ssh_exception.SSHException even though known_hosts file provided?

Getting error paramiko.ssh_exception.SSHException: No hostkey for host target.org found. when using pysftp (for a connection that requires a specific port), even though I am providing the same known_hosts file that was initially used to connect to…
lampShadesDrifter
  • 3,925
  • 8
  • 40
  • 102
2
votes
1 answer

Python SFTP issue With Sockets Closing - An existing connection was forcibly closed by the remote host (10054) - How to continue? Breaks process,

So I have a process where I sunbmit a series of directories and files to a service. The service processes those files and then returns the directories and output files into a different directory For example, there will be a parent directory with…
2
votes
1 answer

Curl command is getting failed to aws instance

I have setup a aws ec2 linux instnace with sftp server configured. I am able to send curl command from cli of linux server to aws instance with below command: curl sftp://username:password@ec2-instance/dir/ But when I use same command from python…
2
votes
4 answers

sftp to aws lightsail python using pysftp key error

I have aws ssh key as awskey.pem. I am trying to sftp to the host with pysftp. import pysftp as sftp keyfile='c:\\awskey.pem' Cnopts=sftp.CnOpts() Cnopts.hostkeys.load(keyfile) srv=sftp.connection(host…
M Newton
  • 29
  • 6