File tree 1 file changed +7
-11
lines changed
1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -41,23 +41,19 @@ def save(self):
41
41
Saves or updates the current object instance depending on the
42
42
presence of `object.id`.
43
43
"""
44
- if self .id :
45
- method = 'put'
46
- resource = self .RESOURCE .format (account_id = self .account .id , id = self .id )
47
- else :
48
- method = 'post'
49
- resource = self .RESOURCE_COLLECTION .format (account_id = self .account .id )
50
-
51
44
params = self .to_params ()
52
45
if 'tweet_id' in params :
53
46
params ['tweet_ids' ] = [params ['tweet_id' ]]
54
47
del params ['tweet_id' ]
55
48
56
- response = Request (
57
- self .account .client , method ,
58
- resource , params = params ).perform ()
49
+ if self .id :
50
+ resource = self .RESOURCE .format (account_id = self .account .id , id = self .id )
51
+ response = Request (self .account .client , 'put' , resource , params = params ).perform ()
52
+ return self .from_response (response .body ['data' ])
59
53
60
- self .from_response (response .body ['data' ])
54
+ resource = self .RESOURCE_COLLECTION .format (account_id = self .account .id )
55
+ response = Request (self .account .client , 'post' , resource , params = params ).perform ()
56
+ return self .from_response (response .body ['data' ][0 ])
61
57
62
58
# promoted tweet properties
63
59
# read-only
You can’t perform that action at this time.
0 commit comments