示例#1
0
文件: auth.py 项目: hhatto/chatpy
 def get_username(self):
     if self.username is None:
         api = API(self)
         user = api.me()
         if user:
             self.username = user.name
         else:
             raise ChatpyError("Unable to get username, invalid token!")
     return self.username
示例#2
0
 def get_username(self):
     if self.username is None:
         api = API(self)
         user = api.me()
         if user:
             self.username = user.name
         else:
             raise ChatpyError("Unable to get username, invalid token!")
     return self.username
示例#3
0
def test_auth_ok():
    auth = TokenAuthHandler(chatwork_token)
    api = API(auth)
    api.me()
示例#4
0
def test_auth_ng():
    auth = TokenAuthHandler("invalid_token")
    api = API(auth)
    api.me()