Handle simplejson being installed when handling JSONDecodeError
authorHarmon <Harmon758@gmail.com>
Wed, 29 Sep 2021 15:02:07 +0000 (10:02 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 29 Sep 2021 15:02:07 +0000 (10:02 -0500)
tweepy/errors.py

index e258c6af9bb1a8bcb72fac24f8ab3456b1dffa6f..fad1cbf9c0c84c4e52a2e3072b694139a184d915 100644 (file)
@@ -2,7 +2,12 @@
 # Copyright 2009-2021 Joshua Roesslein
 # See LICENSE for details.
 
-import json
+try:
+    # Handle https://github.com/psf/requests/issues/5794 until requests 2.27.0
+    # is released with https://github.com/psf/requests/pull/5856
+    import simplejson as json
+except ImportError:
+    import json
 
 
 class TweepyException(Exception):