Save raw JSON after extracting the event, if present.
authorUtkarsh Upadhyay <502876+musically-ut@users.noreply.github.com>
Thu, 2 Jul 2020 18:40:59 +0000 (20:40 +0200)
committerGitHub <noreply@github.com>
Thu, 2 Jul 2020 18:40:59 +0000 (20:40 +0200)
Co-authored-by: Harmon <Harmon758@gmail.com>
tweepy/models.py

index 0bbb6d7c929722c4abde015e26cdda0093d67f0e..6f764c22994ea4092786d2181f0eb17e916228c8 100644 (file)
@@ -231,9 +231,9 @@ class DirectMessage(Model):
     @classmethod
     def parse(cls, api, json):
         dm = cls(api)
-        setattr(dm, '_json', json)
         if "event" in json:
             json = json["event"]
+        setattr(dm, '_json', json)
         for k, v in json.items():
             setattr(dm, k, v)
         return dm