Module gopherlib
[hide private]
[frames] | no frames]

Module gopherlib

Gopher protocol client interface.

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

Imports: warnings


Function Details [hide private]

path_to_datatype_name(path)

 

Takes a path as returned by urlparse and maps it to a string. See section 3.4 of RFC 1738 for details.


Variables Details [hide private]

_names

Value:
['A_BINARY',
 'A_CALENDAR',
 'A_CSO',
 'A_DUPLICATE',
 'A_ERROR',
 'A_EVENT',
 'A_GIF',
 'A_HTML',
...