API
Provides tools for working with Gopher maps.
GopherItem
A class for holding an item in the Gopher map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The line of text from the Gopher map. |
required |
GopherMap
A class for parsing and holding a Gopher map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The text of the Gopher map. |
required |
GopherMapError
Bases: Exception
Base exception for all errors raised by the GopherMap library.
ItemType
Bases: StrEnum
An enumeration for the different types of Gopher items.
AUDIO
class-attribute
instance-attribute
AUDIO = 's'
An audio file.
BINARY
class-attribute
instance-attribute
BINARY = '9'
A binary file.
BINHEX
class-attribute
instance-attribute
BINHEX = '4'
A BinHexed file.
CSO
class-attribute
instance-attribute
CSO = '2'
A CSO phone book.
DOCUMENT
class-attribute
instance-attribute
DOCUMENT = 'd'
A document file.
DOS_FILE
class-attribute
instance-attribute
DOS_FILE = '5'
A DOS file.
ERROR
class-attribute
instance-attribute
ERROR = '3'
An error message.
GIF
class-attribute
instance-attribute
GIF = 'g'
A GIF image.
HTML
class-attribute
instance-attribute
HTML = 'h'
An HTML file.
IMAGE
class-attribute
instance-attribute
IMAGE = 'I'
An image file.
INDEX_SEARCH
class-attribute
instance-attribute
INDEX_SEARCH = '7'
An index search.
INFO
class-attribute
instance-attribute
INFO = 'i'
An informational message.
MENU
class-attribute
instance-attribute
MENU = '1'
A menu.
PDF
class-attribute
instance-attribute
PDF = 'P'
A PDF file.
TELNET
class-attribute
instance-attribute
TELNET = '8'
A telnet session.
TEXT
class-attribute
instance-attribute
TEXT = '0'
A text file.
UNKNOWN
class-attribute
instance-attribute
UNKNOWN = 'unknown'
An unknown type.
UUENCODED
class-attribute
instance-attribute
UUENCODED = '6'
A uuencoded file.
XML
class-attribute
instance-attribute
XML = 'X'
An XML file.
mime_type
property
mime_type: str
Get the MIME type for the item type.
Note
This is a best-effort mapping and may not be accurate for all item types.
NoFields
Bases: GopherMapError
Raised when a Gopher item has no fields.