gusmobile

python gemini client library
git clone https://git.clttr.info/gusmobile.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 2a165e60b3d78942d37e78d0324369d12e4f7b96
parent 72e639c07d06c48c5b545d238e35e406c1aece89
Author: Natalie Pendragon <natpen@natpen.net>
Date:   Sat,  7 Mar 2020 09:26:44 -0500

Handle input type responses

Diffstat:
Mgusmobile/client.py | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gusmobile/client.py b/gusmobile/client.py @@ -42,15 +42,17 @@ class Response: url = None status = None status_meta = None + prompt = None def __init__( - self, content=None, content_type=None, url=None, status=None, status_meta=None + self, content=None, content_type=None, url=None, status=None, status_meta=None, prompt=None ): self.content = content self.content_type = content_type self.url = url self.status = status self.status_meta = status_meta + self.prompt = prompt def fetch(url): @@ -100,13 +102,14 @@ def fetch(url): # Handle headers. Not all headers are handled yet. # Input if status.startswith("1"): - raise NotImplementedError() + return Response( + url=url.geturl(), + status=status, + prompt=meta, + ) # Redirects elif status.startswith("3"): - # print("REDIRECT: %s" % meta) return Response( - content=None, - content_type=None, url=urllib.parse.urlparse(meta).geturl(), status=status, )