getting the status codes from the ftplib module
John J. Lee
jjl at pobox.com
Thu Dec 29 13:58:32 EST 2005
"Alvin A. Delagon" <adelagon at gmail.com> writes:
> I'm writing a simple python code that will upload files onto a ftp
> server. Everything's fine and working great except that the script I
> wrote don't know is an upload is successful or not. Is there a way to
> obtain the ftp status codes with this module? Thanks in advance!
forgot to mention that the urllib2 example I posted is for Python 2.4
-- won't work with 2.3.
For 2.3, 2.2, and 2.1, you have to do:
import urllib2
try:
response = urllib2.urlopen("http://www.reportlab.com/blarney")
except urllib2.HTTPError, e:
print e.code
else:
print 200
urllib2 in 2.0 is a bit broken, IIRC.
John
More information about the Python-list
mailing list