X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fproto.py;h=b1f0ab375e6faba741cc1dc4da86d85ba3950e0c;hb=7be9e8bb560cd4e969992759bbcb523b40e544af;hp=aed5c4edb301992e5280da2ec1b68563e4f06ecb;hpb=08a4b741946ae4d55d864f7c527657ab46b8d83b;p=wrw.git diff --git a/wrw/proto.py b/wrw/proto.py index aed5c4e..b1f0ab3 100644 --- a/wrw/proto.py +++ b/wrw/proto.py @@ -1,3 +1,5 @@ +import time + statusinfo = { 400: ("Bad Request", "Invalid HTTP request."), 401: ("Unauthorized", "Authentication must be provided for the requested resource."), @@ -113,7 +115,7 @@ def parseurl(url): local = local[:q] return proto, host, local, query -def consurl(proto, host, local, query = ""): +def consurl(proto, host, local, query=""): if len(local) < 1 and local[0] != '/': raise urlerror("Local part of URL must begin with a slash") ret = "%s://%s%s" % (proto, host, local) @@ -142,7 +144,7 @@ def requrl(req): raise Exception("Malformed local part when reconstructing URL") return "%s://%s%s" % (proto, host, req.uri) -def parstring(pars = {}, **augment): +def parstring(pars={}, **augment): buf = "" for key in pars: if key in augment: @@ -157,7 +159,7 @@ def parstring(pars = {}, **augment): buf += urlq(key) + "=" + urlq(str(augment[key])) return buf -def parurl(url, pars = {}, **augment): +def parurl(url, pars={}, **augment): qs = parstring(pars, **augment) if qs != "": return url + "?" + qs