From 7b0d9ed8c7eaad9195ecd37ca109ea3439f574cc Mon Sep 17 00:00:00 2001 From: Ville Karaila Date: Wed, 5 Feb 2020 13:17:30 -0800 Subject: [PATCH] Added python 2/3 support hack. --- bottle_oauthlib/oauth2.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bottle_oauthlib/oauth2.py b/bottle_oauthlib/oauth2.py index b3a6372..23a2221 100644 --- a/bottle_oauthlib/oauth2.py +++ b/bottle_oauthlib/oauth2.py @@ -112,7 +112,11 @@ def set_response(bottle_request, bottle_response, status, headers, body, force_j bottle_response.body = body log.debug("Body Bottle response body created as json: %r", bottle_response.body) else: - from urllib.parse import quote + import sys + if ((3, 0) <= sys.version_info <= (3, 9)): + from urllib.parse import quote + elif ((2, 0) <= sys.version_info <= (2, 9)): + from urlparse import urlparse bottle_response["Content-Type"] = "application/x-www-form-urlencoded;charset=UTF-8" bottle_response.body = "&".join([