Guest User

Untitled

a guest
Oct 2nd, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. from weibo import Client
  2.  
  3. API_KEY = '294703483' # app key
  4. API_SECRET = 'a2ef9de0a580edb7a26daf2804d27624' # app secret
  5. REDIRECT_URI= 'https://api.weibo.com/oauth2/default.html' # callback url
  6.  
  7. c = Client(API_KEY, API_SECRET, REDIRECT_URI, token="2.00skPOWG0zpXw_e8253b9b7c9GKIdE", username="chahanfa@gmail.com", password="kgz384570")
  8.  
  9. class Client(object):
  10. def __init__(self, api_key, api_secret, redirect_uri, token=None,
  11. username=None, password=None):
  12. # const define
  13. self.site = 'https://api.weibo.com/'
  14. self.authorization_url = self.site + 'oauth2/authorize'
  15. self.token_url = self.site + 'oauth2/access_token'
  16. self.api_url = self.site + '2/'
  17.  
  18. [root@localhost デスクトップ]# python cinco.py
  19. Traceback (most recent call last):
  20. File "cinco.py", line 7, in <module>
  21. c = Client(API_KEY, API_SECRET, REDIRECT_URI,
  22. token="2.00skPOWG0zpXw_e8253b9b7c9GKIdE", username="chahanfa@gmail.com", password="kgz384570")
  23. File "/usr/lib/python2.7/site-packages/weibo.py", line 45, in __init__
  24. self.set_token(token)
  25. File "/usr/lib/python2.7/site-packages/weibo.py", line 84, in set_token
  26. self.uid = token['uid']
  27. TypeError: string indices must be integers, not str
  28.  
  29. {"access_token":"2.00skPOWG0zpXw_e8253b9b7c9GKIdE","remind_in":"157679999","expires_in":157679999,"uid":"5973036902”}
  30. code=682ac33cecf21d6efee0882e2a91eba4
Add Comment
Please, Sign In to add comment