Added _json atribute to Models: List, Friendship and Category
authorHenrique Hott <henrique.hott1996@gmail.com>
Sun, 3 Feb 2019 23:51:23 +0000 (21:51 -0200)
committerHenrique Hott <henrique.hott1996@gmail.com>
Sun, 3 Feb 2019 23:51:23 +0000 (21:51 -0200)
tweepy/models.py

index 21449d0374e606525e89f1107f0925a287942dd9..1940d7fc565bfdcf3e3c39aaee3dd8b64aa95dc8 100644 (file)
@@ -225,25 +225,25 @@ class Friendship(Model):
     @classmethod
     def parse(cls, api, json):
         relationship = json['relationship']
-
         # parse source
         source = cls(api)
+        setattr(source,'_json',relationship['source'])
         for k, v in relationship['source'].items():
             setattr(source, k, v)
-
+        
         # parse target
         target = cls(api)
+        setattr(target,'_json',relationship['target'])
         for k, v in relationship['target'].items():
             setattr(target, k, v)
-
         return source, target
 
-
 class Category(Model):
 
     @classmethod
     def parse(cls, api, json):
         category = cls(api)
+        setattr(category,'_json',json)
         for k, v in json.items():
             setattr(category, k, v)
         return category
@@ -289,6 +289,7 @@ class List(Model):
     @classmethod
     def parse(cls, api, json):
         lst = List(api)
+        setattr(lst,'_json',json)
         for k, v in json.items():
             if k == 'user':
                 setattr(lst, k, User.parse(api, v))