I have some simple ftps code, that works on my laptop when connected via WIFI. However if I use my ATT IPhones tethering capabilities the code no longer runs on my laptop and the following error is thrown:
*cmd* 'AUTH TLS'
*put* 'AUTH TLS\r\n'
*get* '234 Proceed with negotiation.\r\n'
*resp* '234 Proceed with negotiation.'
Traceback (most recent call last):
File "/Users/n/anaconda/lib/python2.7/ftplib.py", line 669, in login
self.auth()
File "/Users/n/anaconda/lib/python2.7/ftplib.py", line 681, in auth
server_hostname=self.host)
File "/Users/n/anaconda/lib/python2.7/ssl.py", line 352, in wrap_socket
_context=self)
File "/Users/n/anaconda/lib/python2.7/ssl.py", line 579, in __init__
self.do_handshake()
File "/Users/n/anaconda/lib/python2.7/ssl.py", line 808, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:590)
[Finished in 52.4s with exit code 1]
How can I get the following example to work while using tethering?
from ftplib import FTP_TLS
url = 'url.com'
username = 'guest'
password = 'password'
ftps = FTP_TLS(url)
ftps.login(username, password) # login anonymously before securing control channel
ftps.prot_p() # switch to secure data connection
print ftps.nlst()
ftps.quit()
I have also tried including the SSL monkey patch from this stackoverflow answer with no success.
import ssl
ssl._create_default_https_context = ssl._create_unverified_context