diff --git a/fbchat/client.py b/fbchat/client.py index 7109644..8b2a2b6 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -11,7 +11,10 @@ from .utils import * from .models import * from .graphql import * import time - +try: + from urllib.parse import urlparse, parse_qs +except ImportError: + from urlparse import urlparse, parse_qs class Client(object): @@ -1313,6 +1316,25 @@ 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.warning("Error while removing friend") + return False """ LISTEN METHODS diff --git a/fbchat/utils.py b/fbchat/utils.py index c3fe933..7801b82 100644 --- a/fbchat/utils.py +++ b/fbchat/utils.py @@ -122,7 +122,8 @@ class ReqUrl(object): ATTACHMENT_PHOTO = "https://www.facebook.com/mercury/attachments/photo/" EVENT_REMINDER = "https://www.facebook.com/ajax/eventreminder/create" MODERN_SETTINGS_MENU = "https://www.facebook.com/bluebar/modern_settings_menu/" - + REMOVE_FRIEND = "https://m.facebook.com/a/removefriend.php" + pull_channel = 0 def change_pull_channel(self, channel=None):