~fkfd/sophon

b18e3a11e905f8955eeecd8ce77992cb057bf268 — Frederick Yin 3 years ago 57f9e6c
User-definable server
2 files changed, 7 insertions(+), 2 deletions(-)

M test/demo_client.py
M test/gcat.py
M test/demo_client.py => test/demo_client.py +6 -1
@@ 2,10 2,15 @@
import subprocess
import os
import urllib
import argparse
from datetime import datetime
from diff_match_patch import diff_match_patch
from gcat import gemini_request

argparser = argparse.ArgumentParser()
argparser.add_argument("-s", "--server", help="gemini://wiki.server.tld")
args = argparser.parse_args()
server = args.server

def generate_unidiff(old: str, new: str) -> str:
    differ = diff_match_patch()


@@ 16,7 21,7 @@ def generate_unidiff(old: str, new: str) -> str:


def req(path: str):
    return gemini_request(path)
    return gemini_request(path, server)


def preq(path: str):

M test/gcat.py => test/gcat.py +1 -1
@@ 20,7 20,7 @@ def absolutise_url(base, relative):
    return relative


def gemini_request(url):
def gemini_request(url, base=base_url):
    # url should look like /path/to/resource?optional_query
    url = base_url + url
    parsed_url = urllib.parse.urlparse(url)