FtpDownloader | Simple recursive async ftp downloader based on aioftp | FTP library
kandi X-RAY | FtpDownloader Summary
kandi X-RAY | FtpDownloader Summary
Simple recursive async ftp downloader based on aioftp. Download only modified files.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of FtpDownloader
FtpDownloader Key Features
FtpDownloader Examples and Code Snippets
$ pip3 install ftp_downloader
from ftp_downloader import FTPDownloader
ftp_client=FTPDownloader(FTP_HOST, FTP_PORT, FTP_USER, FTP_PASSWORD)
ftp_client.download_dir(download_from_dir='directory')
$ pip3 install ftp_downloader
from ftp_downloader import FTPDownloader
ftp_client=FTPDownloader(FTP_HOST, FTP_PORT, FTP_USER, FTP_PASSWORD)
ftp_client.download_dir(download_from_dir='directory')
class TestMyAwesomeTest:
@patch.object(sys.modules[__name__], 'FTP', autospec=True)
def test_get_listing(self, mocked_ftp):
mocked_ftp.return_value.nlst.return_value = ['abc.csv']
ftp_downloader = FTPDownloader()
Community Discussions
Trending Discussions on FtpDownloader
QUESTION
I'm trying to write a unit test for my ftp downloader. For some reason my import isn't patched. I can see while debugging the ftp object is a real FTP object instead of a mocked one. I'm using Python 3.5 with pytest.
here is my code:
...ANSWER
Answered 2020-Sep-03 at 13:50The problem is here that you are patching a class in the same file. The default approach as mentioned in where to patch works for source files separate from the test files (the usual case). If you have the source in the same file as the test, you can use patch.object
with the current module instead:
QUESTION
I have been asked to make the secure FTP Server connection. FTP over explicit TLS/SSL. In order to achieve this, I have added a below line in the existing implementation. This is my FTPClient lib - it.sauronsoftware.ftp4j - version 1.6.1
ftpClient.setSecurity(FTPClient.SECURITY_FTPES);
// Existing code
ftpClient.setConnector(new HTTPTunnelConnector(proxyHost, proxyPort));
ftpClient.connect(getFtpHost(), getFtpPort());
ftpClient.login(getUsername(), getPassword());
ftpClient.setAutoNoopTimeout(30000);
When I deployed the code on JBOSS 5.1, I am getting successful connection, but I am unable to list the files in the root directory. we only have permission to access the root directory.
On the other hand, I have written a standalone client (java main program) - through which I can print the files present at FTP location, by this way I have ensured the secure connection and the files availability at FTP location. Here, I have used the
My problem is, when I make a secure connection through the deployed application I am getting the unable to locate any files at remote location. ie: FTPFiles.length is 0
Any help would be much appreciated, thank you!
Adding few more logs and info, Normal Flow without FTPES security parameter added (current Implementation)
printing ftpClient.serverStatus()
msg: Status of 'FTP Service'
msg: Connected from ec2-xyz
msg: Logged in as
msg: TYPE: BINARY, STRUcture: File, Mode: Stream
msg: Total bytes transferred for session: 10511
msg: No data connection
msg: End of status
printing ftpClient.serverStatus() With FTPES added
msg: Status of 'FTP Service'
msg: Connected from ec2-xyz
msg: Logged in as
msg: TYPE: ASCII, STRUcture: File, Mode: Stream
msg: No data connection
msg: End of status
Few questions which I need to know answers (may be that give a lead to fix):
- Here, TYPE: BINARY is changed to ASCII and can someone tell how to modify back to BINARY? Note tehre is no explicit setting made, got changed post FTPES set
- Is this issue related to proxy / port. if so - I wont be able to provide those information.
- As of now, I am testing with same proxy used which is used in the application.
- Is there any certificates to be imported to get files viewed / downloaded.
- Found this on net which is exactly same as my issue, http://www.proftpd.org/docs/howto/TLS.html ( search for -"I can login using FTPS, but I cannot see any directories. Why not?") but I need to explain my third party to make the required change... what should I tell?
stand alone client code
...ANSWER
Answered 2018-May-20 at 16:15Finally, I am able to make the secure connection and able to download the latest files from FTP server using FTPES (FTP over explicit TLS/SSL). I have made only 2 line code changes (below), in the actual implementation. earlier it was having the list() method to get the files from FTP server, and its return type is FTPFile[]
This is the code changes which I made, and other line of codes are modified / removed.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install FtpDownloader
You can use FtpDownloader like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page