13.04下的微博客户端,欢迎使用~支持sohu和sina哦
[复制链接]
本帖最后由 kobe 于 2013-4-18 14:32 编辑
对于firends-sohu,目前13.04的版本安装了friends后应该是无法查看到sohu博客的,因为friends有个bug,不支持sohu的ClientId,目前friends源码中已经解决了这个问题,官方源中的代码更新可能还需要一段时间。
现在按照我的方法手动修改代码也是可以实现的,
步骤:
1、sudo vim /usr/lib/python3/dist-packages/friends/utils/base.py
2、找到class Base类下面有个函数:_get_oauth_headers(self, method, url, data=None, headers=None)
3、将里面的代码替换成:
params = self._account.auth.parameters # "Client" == "Consumer" in oauthlib parlance. key = params.get('ConsumerKey') or params.get('ClientId') secret = params.get('ConsumerSecret') or params.get('ClientSecret') # "resource_owner" == secret and token. resource_owner_key = self._get_access_token() resource_owner_secret = self._account.secret_token oauth_client = Client( key, secret, resource_owner_key, resource_owner_secret) headers = headers or {} if data is not None: headers['Content-Type'] = 'application/x-www-form-urlencoded' # All we care about is the headers, which will contain the # Authorization header necessary to satisfy OAuth. uri, headers, body = oauth_client.sign( url, body=data, headers=headers or {}, http_method=method) return headers
|
|