From 0bf1ac2ff3015d0072a336e670bd952d0e73535e Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Wed, 21 Mar 2018 17:15:16 +0100 Subject: [PATCH] Allow None in parurl values to omit keys. --- wrw/proto.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wrw/proto.py b/wrw/proto.py index 80e2419..70f8f77 100644 --- a/wrw/proto.py +++ b/wrw/proto.py @@ -187,11 +187,15 @@ def parstring(pars={}, **augment): del augment[key] else: val = pars[key] + if val is None: + continue if buf != "": buf += "&" buf += urlq(key) + "=" + urlq(str(val)) - for key in augment: + for key, val in augment.items(): + if val is None: + continue if buf != "": buf += "&" - buf += urlq(key) + "=" + urlq(str(augment[key])) + buf += urlq(key) + "=" + urlq(str(val)) return buf def parurl(url, pars={}, **augment): -- 2.11.0