Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from weibo import Client
- API_KEY = '294703483' # app key
- API_SECRET = 'a2ef9de0a580edb7a26daf2804d27624' # app secret
- REDIRECT_URI= 'https://api.weibo.com/oauth2/default.html' # callback url
- c = Client(API_KEY, API_SECRET, REDIRECT_URI, token="2.00skPOWG0zpXw_e8253b9b7c9GKIdE", username="chahanfa@gmail.com", password="kgz384570")
- class Client(object):
- def __init__(self, api_key, api_secret, redirect_uri, token=None,
- username=None, password=None):
- # const define
- self.site = 'https://api.weibo.com/'
- self.authorization_url = self.site + 'oauth2/authorize'
- self.token_url = self.site + 'oauth2/access_token'
- self.api_url = self.site + '2/'
- [root@localhost デスクトップ]# python cinco.py
- Traceback (most recent call last):
- File "cinco.py", line 7, in <module>
- c = Client(API_KEY, API_SECRET, REDIRECT_URI,
- token="2.00skPOWG0zpXw_e8253b9b7c9GKIdE", username="chahanfa@gmail.com", password="kgz384570")
- File "/usr/lib/python2.7/site-packages/weibo.py", line 45, in __init__
- self.set_token(token)
- File "/usr/lib/python2.7/site-packages/weibo.py", line 84, in set_token
- self.uid = token['uid']
- TypeError: string indices must be integers, not str
- {"access_token":"2.00skPOWG0zpXw_e8253b9b7c9GKIdE","remind_in":"157679999","expires_in":157679999,"uid":"5973036902”}
- code=682ac33cecf21d6efee0882e2a91eba4
Add Comment
Please, Sign In to add comment