Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Python 3 library for building Gopher clients and servers

Project description


Documentation Status PyPI version PyPI license

Python 3 library for building Gopher clients and servers

Pituophis, at the moment, requires nine modules: os, re, sockets, asyncio, ssl, mimetypes, glob, and urllib, which are standard in most Python 3.7 installations, and natsort. Pituophis can simply be loaded as a module like this:

import pituophis


Pituophis can grab files and text from Gopher servers (both S/Gopher TLS and regular Gopher) through the Request.get() and get() functions.


Getting menus and files as plain text:

pituophis.get(host='', port=70, path='/').text()
pituophis.get(host='', port=70, path='/gopher/proxy').text()
pituophis.get(host='', port=105, path='/', tls=True).text() # TLS!
pituophis.get('gophers://').text() # gophers:// URLs!

Getting a menu, parsed:

menu = pituophis.get('').menu()
for selector in menu:

Using search services:

pituophis.get(host='', port=70, path='/v2/vs', query='toast').text()

Downloading a binary:

pituophis.get(host='', port=70, path='/gopher/clients/win/').binary

Requests can also be created and worked with directly:

import pituophis
req = pituophis.Request() = ''  # set to by default
req.port = 70  # set to 70 as default, as per tradition
req.type = '7'  # set to 9 by default, purely for client usage
req.path = '/v2/vs'  # set to '/' by default
req.query = 'food'  # set to '' (nothing) by default
req.tls = False  # set to False by default
print('Getting', req.url())
rsp = req.get()

They can also be created from a URL:

import pituophis
req = pituophis.parse_url('gopher://')
print('Getting', req.url())
rsp = req.get()


Default Handler

Pituophis now lets you serve a directory. Serving gophermaps, directories, and files is supported out of the box.


Custom Handler

Pituophis also lets you write a custom handler for Gopher requests.


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
Pituophis-0.99-py3.7.egg (15.9 kB) Copy SHA256 hash SHA256 Egg 3.7
Pituophis-0.99.tar.gz (8.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page