remove python2 support from awxkit

This commit is contained in:
Ryan Petrello
2020-03-19 09:02:39 -04:00
parent db7f0f9421
commit 06b3e54fb1
18 changed files with 27 additions and 116 deletions
+2 -5
View File
@@ -1,6 +1,6 @@
import logging
from six.moves import http_client as http
import http.client as http
import awxkit.exceptions as exc
from awxkit.api.mixins import DSAdapter, HasCopy, HasCreate
@@ -19,10 +19,7 @@ from awxkit.utils import (
from . import base, page
from .page import exception_from_status_code
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
from urllib.parse import urljoin
log = logging.getLogger(__name__)
+2 -6
View File
@@ -4,8 +4,7 @@ import json
import re
from requests import Response
import six
from six.moves import http_client as http
import http.client as http
from awxkit.utils import (
PseudoNamespace,
@@ -170,10 +169,7 @@ class Page(object):
def from_json(cls, raw):
resp = Response()
data = json.dumps(raw)
if six.PY3:
resp._content = bytes(data, 'utf-8')
else:
resp._content = data
resp._content = bytes(data, 'utf-8')
resp.encoding = 'utf-8'
resp.status_code = 200
return cls(r=resp)