Gopher protocol client interface.
- get_alt_binary(f, func, blocksize)
- Get a binary file and pass each block to a function.
- get_alt_textfile(f, func)
- Get a text file and pass each line to a function, with trailing CRLF stripped.
- Get a binary file as one solid data block.
- Get a directory in the form of a list of entries.
- Get a text file as a list of lines, with trailing CRLF stripped.
- Takes a path as returned by urlparse and maps it to a string.
See section 3.4 of RFC 1738 for details.
- Takes a path as returned by urlparse and returns the appropriate selector.
- send_query(selector, query, host, port=0)
- Send a selector and a query string.
- send_selector(selector, host, port=0)
- Send a selector to a given host and port, return a file with the reply.
- Trivial test program.
- Map all file types to strings; unknown types become TYPE='x'.
||A_BINARY = '9'|
A_CALENDAR = 'c'
A_CSO = '2'
A_DUPLICATE = '+'
A_ERROR = '3'
A_EVENT = 'e'
A_GIF = 'g'
A_HTML = 'h'
A_IMAGE = 'I'
A_INDEX = '7'
A_MACBINHEX = '4'
A_MENU = '1'
A_MIME = 'M'
A_PCBINHEX = '5'
A_PLUS_IMAGE = ':'
A_PLUS_MOVIE = ';'
A_PLUS_SOUND = '<'
A_QUERY = 'q'
A_SOUND = 's'
A_TELNET = '8'
A_TEXT = '0'
A_TN3270 = 'T'
A_UUENCODED = '6'
A_WHOIS = 'w'
A_WWW = 'w'
CRLF = '\r\n'
DEF_HOST = 'gopher.micro.umn.edu'
DEF_PORT = 70
DEF_SELECTOR = '1/'
TAB = '\t'
__all__ = ['send_selector', 'send_query']