diff --git a/fbchat/client.py b/fbchat/client.py index 448f92c..099799f 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -12,11 +12,9 @@ from .models import * from .graphql import * import time try: - from urllib.parse import urlparse - from urllib.parse import parse_qs + from urllib.parse import urlparse,parse_qs except ImportError: - from urlparse import urlparse - from urlparse import parse_qs + from urlparse import urlparse,parse_qs class Client(object): @@ -473,26 +471,7 @@ class Client(object): """ END DEFAULT THREAD METHODS """ - def removeFriend(self, friend_id=None): - """ - Removes a specifed friend from your friend list - :param friend_id: The id of the friend that you want to remove - :returns error when the removing was unsuccessful - :returns True when the removing was successful - """ - payload = { - "friend_id": friend_id, - "unref": "none", - "confirm": "Confirm", - } - r = self._post(self.req_url.REMOVE_FRIEND,payload) - dict = parse_qs(urlparse(r.url).query) - if "err" not in dict: - print ("Remove was successful!") - return True - else: - print ("Error while removing friend") - return False + """ FETCH METHODS """ @@ -1337,8 +1316,27 @@ class Client(object): r = self._post(self.req_url.CONNECT, data) return r.ok - - + + def removeFriend(self, friend_id=None): + """ + Removes a specifed friend from your friend list + :param friend_id: The id of the friend that you want to remove + :return: Returns error if the removing was unsuccessful, returns True when successful. + """ + payload = { + "friend_id": friend_id, + "unref": "none", + "confirm": "Confirm", + } + r = self._post(self.req_url.REMOVE_FRIEND,payload) + query = parse_qs(urlparse(r.url).query) + if "err" not in query: + log.debug ("Remove was successful!") + return True + else: + log.debug ("Error while removing friend") + return False + """ LISTEN METHODS """