Skip to content

Commit c015fd5

Browse files
committed
支持赞操作
1 parent ae44648 commit c015fd5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

chinaapi/sina/weibo/open.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ def _prepare_url(self, segments, queries):
3131
prefix = 'rm.'
3232
else:
3333
prefix = ''
34-
return 'https://{0}api.weibo.com/2/{1}.json'.format(prefix, '/'.join(segments))
34+
url = 'https://{0}api.weibo.com/2/{1}.json'.format(prefix, '/'.join(segments))
35+
if 'like' in segments:
36+
# like操作需source和access_token参数,否则无法执行
37+
queries['source'] = self.app.key
38+
if not self.token.is_expires:
39+
queries['access_token'] = self.token.access_token
40+
return url.replace('weibo.com', 'weibo.cn')
41+
return url
3542

3643
def _prepare_method(self, segments):
3744
segment = segments[-1].lower()

0 commit comments

Comments
 (0)