Exemplo n.º 1
0
    def get_user_info_by_email(self, email):

        try:
            uid = auth.get_user_by_email(email).uid
            user = self._db.collection('users').document(uid).get()
        except:
            return {'msg': '找不到使用者!'}, status_code.NOT_FOUND

        if user.exists:
            user_dict = User.from_dict(user.to_dict()).to_dict()
            user_dict.update({'uid': user.id})
            print(user_dict, file=sys.stderr)
            return user_dict, status_code.OK
Exemplo n.º 2
0
 def get_user_info_by_uid(self, uid=None):
     if uid == None:
         user = self._db.collection('users').document(self._uid).get()
     else:
         try:
             auth.get_user(uid)
             user = self._db.collection('users').document(uid).get()
         except:
             return {'msg': '找不到使用者!'}, status_code.NOT_FOUND
     if user.exists:
         user_dict = User.from_dict(user.to_dict()).to_dict()
         user_dict.update({'uid': user.id})
         print(user_dict, file=sys.stderr)
         return user_dict, status_code.OK