Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Accept Friend Request #372

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions fbchat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,24 @@ def friendConnect(self, friend_id):
r = self._post(self.req_url.CONNECT, data)
return r.ok

def acceptFriendRequest(self, from_id=None):
"""
Accepts a friend request.

:param from_id: The ID of the person who sent the friend request.
:return: Returns error if the accepting was unsuccessful, returns True when successful.
"""
payload = {
"actions[accept]": "1",
"confirm": str(from_id),
"list_item_id": str(from_id) + "_1_req",
"nctr[_mod]": "pagelet_bluebar",
"request_id": str(from_id),
"status_div_id": str(from_id) + "_1_req_status",
"type": "friend_connect"
}
r = self._post(self.req_url.ACCEPT_FRIEND_REQ, payload)

def removeFriend(self, friend_id=None):
"""
Removes a specifed friend from your friend list
Expand Down
1 change: 1 addition & 0 deletions fbchat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class ReqUrl(object):
GET_POLL_OPTIONS = "https://www.facebook.com/ajax/mercury/get_poll_options"
SEARCH_MESSAGES = "https://www.facebook.com/ajax/mercury/search_snippets.php?dpr=1"
MARK_SPAM = "https://www.facebook.com/ajax/mercury/mark_spam.php?dpr=1"
ACCEPT_FRIEND_REQ = "https://www.facebook.com/ajax/reqs.php?dpr=1"

pull_channel = 0

Expand Down