Handle empty payloads in JSONParser.parse
authorHarmon <Harmon758@gmail.com>
Mon, 30 Jan 2023 18:49:11 +0000 (12:49 -0600)
committerHarmon <Harmon758@gmail.com>
Mon, 30 Jan 2023 18:51:07 +0000 (12:51 -0600)
Resolves #2051

tweepy/parsers.py

index a6ca97d02f14f5856c33db5641717ca38a293f50..2aee1a5e4d05596dc29111f006e3fd26592dda50 100644 (file)
@@ -33,6 +33,9 @@ class JSONParser(Parser):
     payload_format = 'json'
 
     def parse(self, payload, *, return_cursors=False, **kwargs):
+        if not payload:
+            return
+
         try:
             json = json_lib.loads(payload)
         except Exception as e: