Skip to content

Instantly share code, notes, and snippets.

@prologic
Created December 15, 2014 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prologic/b781e02b0299fef1f3f6 to your computer and use it in GitHub Desktop.
Save prologic/b781e02b0299fef1f3f6 to your computer and use it in GitHub Desktop.
created by github.com/tr3buchet/gister
#!/usr/bin/env python
from __future__ import print_function
from collections import deque
from gopherlib import Gopher, GopherMenu
host = "arrow.shortcircuit.net.au"
port = 70
q = deque()
g = Gopher(host, port)
data = g.get_selector("1/")
items = data.get_data()
selectors = [item for item in items if item["type"] != "i"]
for selector in selectors:
print("{0: <40s}{1:s}".format(selector["selector"], selector["name"]))
if selector["host"] == host:
q.append(selector["selector"])
while q:
data = g.get_selector(q.popleft())
if isinstance(data, GopherMenu):
items = data.get_data()
selectors = [item for item in items if item["type"] != "i"]
for selector in selectors:
print("{0: <40s}{1:s}".format(selector["selector"], selector["name"]))
if selector["host"] == host:
q.append(selector["selector"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment