File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,9 @@ def de_json(data):
3232 file_size = data .get ('file_size' , None ))
3333
3434 def to_dict (self ):
35- data = {'file_id' : self .file_id ,
36- 'thumb' : self .thumb .to_dict ()}
35+ data = {'file_id' : self .file_id }
36+ if self .thumb :
37+ data ['thumb' ] = self .thumb .to_dict ()
3738 if self .file_name :
3839 data ['file_name' ] = self .file_name
3940 if self .mime_type :
Original file line number Diff line number Diff line change @@ -44,8 +44,9 @@ def to_dict(self):
4444 data = {'file_id' : self .file_id ,
4545 'width' : self .width ,
4646 'height' : self .height ,
47- 'duration' : self .duration ,
48- 'thumb' : self .thumb .to_dict ()}
47+ 'duration' : self .duration }
48+ if self .thumb :
49+ data ['thumb' ] = self .thumb .to_dict ()
4950 if self .mime_type :
5051 data ['mime_type' ] = self .mime_type
5152 if self .file_size :
You can’t perform that action at this time.
0 commit comments