Home | Trees | Indices | Help |
---|
|
Module for parsing FTP data.
Currently, this module contains classes for parsing FTP LIST command output from a variety of FTP servers. In the future, this module may be extended to handle other FTP parsing chores. (Or not.)
The FTP LIST parsing logic was adapted for Python from D. J. Bernstein's ftpparse.c library. See http://cr.yp.to/ftpparse.html. The logic in this module is functionally similar to Bernstein's parser, with the following differences:
- Bernstein's C-specific logic has been made more Python-like.
- The basic parser is encapsulated inside an FTPListDataParser class, instead of a function.
- The ID_TYPE and MTIME_TYPE values are enumerations.
- SIZE_TYPE is not supported (since it was always being set to the same value anyway).
Currently covered formats:
- EPLF
- UNIX ls, with or without group ID
- Microsoft FTP Service
- Windows NT FTP Server
- VMS
- WFTPD
- NetPresenz (Mac)
- NetWare
- MSDOS
- MLST
Definitely not covered:
- Long VMS filenames, with information split across two lines.
- NCSA Telnet FTP server. Has LIST = NLST (and bad NLST for directories).
|
|||
FTPListData The FTPListDataParser class's parse_line() method returns an instance of this class, capturing the parsed data. |
|||
FTPListDataParser An FTPListDataParser object can be used to parse one or more lines that were retrieved by an FTP LIST command that was sent to a remote server. |
|||
FTPMlstDataParser An FTPMlstDataParser object can be used to parse one or more lines that were retrieved by an FTP MLST or MLSD command that was sent to a remote server. |
|
|||
FTPListData |
|
||
dict
|
|
||
bool
|
|
||
|
|
|||
MONTHS =
|
|||
MTIME_TYPE = Enum('UNKNOWN', 'LOCAL', 'REMOTE_MINUTE', 'REMOTE MTIME_TYPE identifies how a modification time ought to be interpreted (assuming the caller cares). |
|||
ID_TYPE = Enum('UNKNOWN', 'FULL') ID_TYPE identifies how a file's identifier should be interpreted. |
|||
now = 1457968860.25
|
|||
current_year = 2016
|
|||
__package__ =
|
|
is_mlst ) and
and passes ftp_list_line to the object's parse_line() method,
returning the result.
|
Issue the FTP FEAT command to an FTP server, and return the resulting feature list as a dictionary. Adapted from code by Andrew Scheller <gcode@loowis.durge.org>.
Parameters:
ftp : open |
Convenience function to determine whether a remote FTP server supports the MLST command or not. This method uses the FTP "FEAT" command to query the capabilities of the server. Adapted from code by Andrew Scheller <gcode@loowis.durge.org>.
Parameters:
ftp : open |
|
MONTHS
|
MTIME_TYPEMTIME_TYPE identifies how a modification time ought to be interpreted (assuming the caller cares).
|
ID_TYPEID_TYPE identifies how a file's identifier should be interpreted.
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Mar 14 15:21:05 2016 | http://epydoc.sourceforge.net |