gusmobile

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/gusmobile.git
Log | Files | Refs | LICENSE

commit a0376fdbc00da564d3a19837a283a9c4d4d625d9
parent 47e40dcabd58ec0bf6347b1285d0a846af86f3aa
Author: Natalie Pendragon <natpen@natpen.net>
Date:   Mon, 20 Jul 2020 08:03:49 -0400

Return error responses

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

diff --git a/gusmobile/client.py b/gusmobile/client.py @@ -45,9 +45,11 @@ class Response: status = None status_meta = None prompt = None + num_bytes = None + error_message = None def __init__( - self, content=None, content_type=None, charset=None, lang=None, url=None, status=None, status_meta=None, prompt=None, num_bytes=None + self, content=None, content_type=None, charset=None, lang=None, url=None, status=None, status_meta=None, prompt=None, num_bytes=None, error_message=None ): self.content = content self.content_type = content_type @@ -58,6 +60,7 @@ class Response: self.status_meta = status_meta self.prompt = prompt self.num_bytes = num_bytes + self.error_message = error_message def fetch(raw_url): @@ -133,7 +136,10 @@ def fetch(raw_url): ) # Errors elif status.startswith("4") or status.startswith("5"): - print("ERROR: %s" % status) + return Response( + status=status, + error_message=meta, + ) return # Client cert elif status.startswith("6"):