{"id":13660738,"url":"https://github.com/dotcomboom/Pituophis","last_synced_at":"2025-04-24T23:30:39.570Z","repository":{"id":50432031,"uuid":"168903505","full_name":"dotcomboom/Pituophis","owner":"dotcomboom","description":"Gopher client and server library for Python","archived":false,"fork":false,"pushed_at":"2023-10-30T07:54:11.000Z","size":6707,"stargazers_count":44,"open_issues_count":6,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-10T05:06:15.718Z","etag":null,"topics":["gopher","gopher-client","gopher-server","python3"],"latest_commit_sha":null,"homepage":"https://dotcomboom.somnolescent.net/pituophis/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotcomboom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-03T03:01:20.000Z","updated_at":"2025-01-14T02:34:17.000Z","dependencies_parsed_at":"2022-08-25T16:22:00.068Z","dependency_job_id":"c2388ce7-3e06-438d-9019-241d87376dfc","html_url":"https://github.com/dotcomboom/Pituophis","commit_stats":{"total_commits":192,"total_committers":2,"mean_commits":96.0,"dds":"0.41145833333333337","last_synced_commit":"c0b6a22136decf9dee0b1bf305e6934095d08c5c"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcomboom%2FPituophis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcomboom%2FPituophis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcomboom%2FPituophis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotcomboom%2FPituophis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotcomboom","download_url":"https://codeload.github.com/dotcomboom/Pituophis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250727441,"owners_count":21477316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gopher","gopher-client","gopher-server","python3"],"created_at":"2024-08-02T05:01:25.210Z","updated_at":"2025-04-24T23:30:39.267Z","avatar_url":"https://github.com/dotcomboom.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Pituophis\n[![Documentation Status](https://readthedocs.org/projects/pituophis/badge/?version=latest)](https://pituophis.readthedocs.io/en/latest/?badge=latest)\n[![PyPI version](https://img.shields.io/pypi/v/Pituophis.svg)](https://pypi.python.org/pypi/Pituophis/)\n[![PyPI license](https://img.shields.io/pypi/l/Pituophis.svg)](https://pypi.python.org/pypi/Pituophis/)\n\nPython 3 library for building Gopher clients and servers\n\n## Installation\nAt a prompt, run `pip3 install pituophis` or `pip install pituophis` depending on your setup. You'll be able to import the package with `import pituophis`.\n\n## Features\n\n- Make and send Gopher requests with the `Request` class\n- URL parsing with `pituophis.parse_url()`\n- Parse and iterate through Gopher menus with `Response.menu()`\n- Host Gopher servers on Python 3.7+, accepting requests asynchronously (using the same `Request` class)\n- Serve directories, files, and gophermaps out of the box from a publish directory ('pub/' by default) with the default handler\n- Use either a custom handler altogether or a handler to use when the default handler encounters a 404 for dynamic functionality\n\n## Server\n\nPituophis can act as a powerful Gopher server, with full Bucktooth-style gophermap and globbing support. Scripting is also supported through alt handlers (used in the event of a 404) or fully custom handlers (replaces Pituophis' handler entirely).\n\nThe simplest method of getting a server up and running is with the `pituophis.serve()` function. See the [examples](https://github.com/dotcomboom/Pituophis/tree/master/examples) and [docs](https://pituophis.readthedocs.io/en/latest/#pituophis.serve) for more information. If you'd like to see a server built with Pituophis that can search an index, try [Gophew](https://github.com/dotcomboom/Gophew).\n\n![server_def](https://github.com/dotcomboom/Pituophis/blob/master/server_def.png?raw=true)\n\n### Quick Start\nA simple quick-start snippet is the following:\n```py\nimport pituophis\npituophis.serve('127.0.0.1', 7070, pub_dir='pub/')  # typical Gopher port is 70\n```\n\nHere's a basic alt handler, if you're familiar with Python scripting and would like to add more interactivity to your server:\n\n```py\ndef alt(request):\n    if request.path == '/test':\n        return [pituophis.Item(text='test!')]\n```\n\nYou can return a list of Item objects, bytes, or text. To use your alt handler, add the argument `alt_handler=alt` to your serve() like this:\n\n```py\npituophis.serve(\"127.0.0.1\", 7070, pub_dir='pub/', alt_handler=alt)\n```\n\n## Client\nPituophis can also grab files and parse menus from Gopher servers. Simple fetching is done with `Request().get()` and `get()`, and `Request().stream()` can be used for lower-level access as a BufferedReader.  The `get` functions return a Response type. [See the docs](https://pituophis.readthedocs.io/en/latest/index.html) for more information.\n\n### TreeGopher\nAn interactive demo of Pituophis' client features is provided in the form of [TreeGopher](https://github.com/dotcomboom/Pituophis/blob/master/TreeGopher.py), a graphical Gopher client in \u003c250 lines of code. It uses Pituophis, [PySimpleGUI](https://github.com/PySimpleGUI/PySimpleGUI), and [Pyperclip](https://pypi.org/project/pyperclip). It can browse Gopher in a hierarchical structure (similarly to WSGopher32, Cyberdog, and [Little Gopher Client](http://runtimeterror.com/tools/gopher/)), cache menus, read text files, download and save binary files (writing in chunks using `Request().stream()`, and running on another thread), recognize URL: links and use search services.\n\n![](https://github.com/dotcomboom/Pituophis/blob/master/treegopher.png?raw=true)\n\n### Examples\nGetting menus and files as plain text:\n```python\npituophis.get('gopher.floodgap.com').text()\npituophis.get('gopher://gopher.floodgap.com/1/').text()\npituophis.get('gopher://gopher.floodgap.com:70/0/gopher/proxy').text()\n```\nGetting a menu, parsed:\n```python\nmenu = pituophis.get('gopher.floodgap.com').menu()\nfor item in menu:\n    print(item.type)\n    print(item.text)\n    print(item.path)\n    print(item.host)\n    print(item.port)\n```\nUsing search services:\n```python\npituophis.get('gopher://gopher.floodgap.com:70/7/v2/vs%09toast').text()\n```\nDownloading a binary:\n```python\npituophis.get('gopher://gopher.floodgap.com:70/9/gopher/clients/win/hgopher2_3.zip').binary\n```\nRequests can also be created from a URL:\n```python\nimport pituophis\nreq = pituophis.parse_url('gopher://gopher.floodgap.com/7/v2/vs%09food')\nprint('Getting', req.url())\nrsp = req.get()\nprint(rsp.text())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotcomboom%2FPituophis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotcomboom%2FPituophis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotcomboom%2FPituophis/lists"}