Merge pull request #298 from ThatAlexanderA/master

Added remove friend
This commit is contained in:
Mads Marquart
2018-06-20 14:29:00 +02:00
committed by GitHub
2 changed files with 25 additions and 2 deletions

View File

@@ -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

View File

@@ -122,6 +122,7 @@ 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