From 0ac43549ed02a589a80bb750b392890a676ae60a Mon Sep 17 00:00:00 2001 From: thekindlyone Date: Mon, 29 Aug 2016 15:25:42 +0530 Subject: [PATCH] improved getUserInfo to return list of results --- fbchat/client.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fbchat/client.py b/fbchat/client.py index 24d0d8a..d59d1f7 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -548,18 +548,16 @@ class Client(object): except requests.exceptions.Timeout: pass - def getUserInfo(self,user_ids): + def getUserInfo(self,*user_ids): """Get user info from id. - :param user_ids: list of or one user id(s) to query + :param user_ids: one or more user id(s) to query """ - if type(user_ids) != list: - user_ids=[user_ids] - data = {"ids[{}]".format(i):user_id for i,user_id in enumerate(user_ids)} r = self._post(UserInfoURL, data) - return get_json(r.text) + info = get_json(r.text) + return [details for profile,details in info['payload']['profiles'].iteritems()]