Python module that implements ftps
I was wondering if anybody could point me towards a free ftps module for python.
I am a complete newbie to python, but this is something I need for a work project. I need an ftps client to connect to a 3rd party ftps server.
thanks,
David.
Asked by: Darcy695 | Posted: 27-01-2022
Answer 1
I believe you could use Twisted to implement FTPS by simply using its FTP implementation, but changing the FTPClient.connectFactory
attribute to be a function that does something with connectSSL
rather than connectTCP
.
Are you sure you want FTPS though? SFTP is a different, better, and much more popular protocol these days: Twisted contains an SFTP implementation as well.
Answered by: John563 | Posted: 28-02-2022Answer 2
The ftplib module in Python version 2.7.1 has all of the functionality you will need, including TLS support.
http://docs.python.org/library/ftplib.html#module-ftplib
Answered by: Dainton864 | Posted: 28-02-2022Answer 3
M2Cypto has a FTPS module. From the documentation:
>>> from M2Crypto import ftpslib
>>> f = ftpslib.FTP_TLS()
>>> f.connect('', 9021)
'220 spinnaker.dyndns.org M2Crypto (Medusa) FTP/TLS server v0.07 ready.'
>>> f.auth_tls()
>>> f.set_pasv(0)
>>> f.login('ftp', 'ngps@')
'230 Ok.'
>>> f.retrlines('LIST')
-rw-rw-r-- 1 0 198 2326 Jul 3 1996 apache_pb.gif
drwxrwxr-x 7 0 198 1536 Oct 10 2000 manual
drwxrwxr-x 2 0 198 512 Oct 31 2000 modpy
drwxrwxr-x 2 0 198 512 Oct 31 2000 bobo
drwxr-xr-x 2 0 198 14336 May 28 15:54 postgresql
drwxr-xr-x 4 100 198 512 May 16 17:19 home
drwxr-xr-x 7 100 100 3584 Sep 23 2000 openacs
drwxr-xr-x 10 0 0 512 Aug 5 2000 python1.5
-rw-r--r-- 1 100 198 326 Jul 29 03:29 index.html
drwxr-xr-x 12 0 0 512 May 31 17:08 python2.1
'226 Transfer complete'
>>> f.quit()
'221 Goodbye.'
>>>
Alternatively, if you wanted to minimise use of third-party modules, you should be able to subclass the standard library's ftplib.FTP class with the built-in (to Python) SSL support. M2Crypto (or Twisted, if you want to go that way) is the easier solution, though.
Answered by: Adrian872 | Posted: 28-02-2022Answer 4
Twisted seems to have some implementation of FTPS (FTP over SSL) under the conch sub-project. I am no twisted expert, but Glyph, the twisted man himself, is listed in this site. Maybe by following his answer to another question, you can find more details (good luck).
Answered by: Elian320 | Posted: 28-02-2022Answer 5
As for the server implementation you can take a look at pyftpdlib: http://code.google.com/p/pyftpdlib/ It includes a demo script implementing a working FTPS server: http://code.google.com/p/pyftpdlib/source/browse/trunk/demo/tls_ftpd.py
As for the client implementation I provided a patch which will be included in python 2.7 and 3.2. http://bugs.python.org/issue2054
Answered by: Julia385 | Posted: 28-02-2022Answer 6
I haven't tried it myself (yes, I just used Google and followed some links), but http://www.lag.net/paramiko/ seems to be the recommended solution. From a cursory glance, it's an SSH implementation in pure Python, which allows tunneling for things like FTP.
Update: a commenter pointed out that I mixed up sftp and ftps, sorry. I still suggest at least investigating Paramiko briefly to see if it matches the requirements.
Answered by: Maya635 | Posted: 28-02-2022Answer 7
I couldn't find a free sftp client for windows so I ended up wrapping Putty's PSFTP using python's subprocess module. I probably would have used the twisted implementation mentioned by Glyph if i'd known about it.
Anyway if your interested it's available at:
http://code.google.com/p/psftplib/
Answered by: Grace746 | Posted: 28-02-2022Similar questions
python - How signal module implements timer
Here is my code for timer
import signal, time
def timeoutHandler():
raise Exception()
try:
signal.signal(signal.SIGALRM, timeoutHandler)
signal.setitimer(signal.ITIMER_REAL, 5)
count = 0
while True:
print count
count += 1
time.sleep(1)
except Exception as e:
print e
It works great, what bothers me is how is this implemented by signal modu...
Python module matrix class that implements Modulo 2 arithmetic?
I'm looking for a pure Python module that implements a matrix class where the underlying matrix operations are computed in modulo 2 arithmetic as in
(x+y)%2
I need to do a lot of basic matrix manipulations ( transpose, multiplication, etc. ).
Any help appreciated.
Thanks in advance
Create a Python type from C that implements a __dict__?
How is a type created to have a __dict__ as per a "normal" class would have were it defined in Python?
Are there any examples of non-dynamic types with __dict__s?
Do types defined via Python's PyTypeObject pass through
Best way to implements this kind of pattern in Java (Python sample inside)?
i am still new to the Java language and libraries... i often use this kind of pattern in Python, and wonder how i should implement this one with Java.
i need to read a huge file line by line, with some kind of xml marking (i am producing the input, so i am sure that there will not be any ambiguity)
i want to iterate inside some parts of the huge file like the python code below :
(using the yield / p...
exception - In python is there a way to know if an object "implements an interface" before I pass it to a function?
I know this may sound like a stupid question, especially to someone who knows python's nature, but I was just wondering, is there a way to know if an object "implements an interface" so as to say?
To give an example of what I want to say:
let's say I have this function:
def get_counts(sequence):
counts = {}
for x in sequence:
if x in counts:
c...
Python package that implements TFTP, FTP, SFTP servers
I'm using tftpy to create TFTP server in my Python program and it works amazing. However, I need to have other flavors of servers: TFTP, FTP, SFTP. What package may I use that supports all of them?
image - Carrying out unit testing in python on a method that implements ImageDraw
I am currently experimenting with the pytest module to create unit tests for a project I'm working on. I'm trying to test the 'add_point' method which draws an ellipse based on a set of pixels. What I want to do is inspect 'draw' to ensure that the ellipse has been created successfully. Unfortunately I don't know how to go about this, so any help will be appreciated. Here's my code so far:
(A) TheSl...
python - What class pattern, or package implements a dict with keys that countdown?
I'm looking for a dictionary like object in which each key has a ttl (or countdown) that is decremented each time .pop() is called. When the counter hits 0 .pop() actually removes it. Something analogous to the Time-to-Live of network packets, which is measured in hops rather than seconds.
I'm guessing something like this exists, but I don't know the name.
python - How to verify if class implements a rich comparison method?
With the old style classes simply using hasattr works:
>>> class old:
... pass
...
>>> hasattr(old, '__eq__')
False
Using the new style classes every class has the attribute __eq__:
>>> class nsc(object):
... pass
...
>>> hasattr(nsc, '__eq__')
True
This is the expected behaviour as
python - spyne - Error when inheriting from a Complex Type and derived class implements a xml attribute
I need to realize existing WSDL.
I try to inherit my complex type class.
But if the derived class implements a xml attribute I get an error.
If the derived class doesn't implement xml attribute I get no error.
Is there anything I do wrong?
(spyne version '2.12.11', python 2.7.9)
Error:
No handlers could be found for logger "spyne.interface.xml_schema"
Traceback (most recent call last):
...
python - How to create a singleton class that implements an abstract class, without getting into metaclass conflict?
I've read a bunch of useful information on SO as well as the article at http://www.phyast.pitt.edu/~micheles/python/metatype.html
However, I think I still did not find the answer. Hence a new question.
I'm creating a library of functions/classes for in-house use. As part of that I would like to create a Singlet...
Still can't find your answer? Check out these communities...
PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python