Drop dependency on simplejson
Recent python 3 versions provide the built-in json module which meet generic requirements. Remove explicit dependency on simplejson and use the built-in module by default, to reduce external dependencies. Also fix the missing requests library in requirements. Depends-on: https://review.opendev.org/920001 Change-Id: Id8d4cec6fe709d1b647281ec4ff76b5104ec88f9
This commit is contained in:
@@ -12,10 +12,9 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
"""Base API Library"""
|
"""Base API Library"""
|
||||||
|
|
||||||
from keystoneauth1 import exceptions as ksa_exceptions
|
from keystoneauth1 import exceptions as ksa_exceptions
|
||||||
from keystoneauth1 import session as ksa_session
|
from keystoneauth1 import session as ksa_session
|
||||||
import simplejson as json
|
import requests
|
||||||
|
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
@@ -153,7 +152,7 @@ class BaseAPI(object):
|
|||||||
# Should this move into _requests()?
|
# Should this move into _requests()?
|
||||||
try:
|
try:
|
||||||
return ret.json()
|
return ret.json()
|
||||||
except json.JSONDecodeError:
|
except requests.JSONDecodeError:
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def delete(self, url, session=None, **params):
|
def delete(self, url, session=None, **params):
|
||||||
@@ -218,7 +217,7 @@ class BaseAPI(object):
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
return ret.json()
|
return ret.json()
|
||||||
except json.JSONDecodeError:
|
except requests.JSONDecodeError:
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
# Layered actions built on top of the basic action methods do not
|
# Layered actions built on top of the basic action methods do not
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ keystoneauth1>=3.14.0 # Apache-2.0
|
|||||||
openstacksdk>=0.15.0 # Apache-2.0
|
openstacksdk>=0.15.0 # Apache-2.0
|
||||||
oslo.i18n>=3.15.3 # Apache-2.0
|
oslo.i18n>=3.15.3 # Apache-2.0
|
||||||
oslo.utils>=3.33.0 # Apache-2.0
|
oslo.utils>=3.33.0 # Apache-2.0
|
||||||
simplejson>=3.5.1 # MIT
|
requests>=2.14.2 # Apache-2.0
|
||||||
stevedore>=1.20.0 # Apache-2.0
|
stevedore>=1.20.0 # Apache-2.0
|
||||||
|
|||||||
Reference in New Issue
Block a user