diff --git a/telegram/base.py b/telegram/base.py index 4123d1412..6d0fe7ff1 100644 --- a/telegram/base.py +++ b/telegram/base.py @@ -18,7 +18,11 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """Base class for Telegram Objects.""" -import json +try: + import ujson as json +except ImportError: + import json + from abc import ABCMeta diff --git a/telegram/utils/request.py b/telegram/utils/request.py index 696e6d95c..5a0845f28 100644 --- a/telegram/utils/request.py +++ b/telegram/utils/request.py @@ -18,7 +18,10 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. """This module contains methods to make POST and GET requests""" -import json +try: + import ujson as json +except ImportError: + import json import os import socket import logging diff --git a/telegram/utils/webhookhandler.py b/telegram/utils/webhookhandler.py index 3abd9a2b3..14c60d3a8 100644 --- a/telegram/utils/webhookhandler.py +++ b/telegram/utils/webhookhandler.py @@ -3,7 +3,10 @@ import logging from telegram import Update from future.utils import bytes_to_native_str from threading import Lock -import json +try: + import ujson as json +except ImportError: + import json try: import BaseHTTPServer except ImportError: