diff --git a/lib/facebook.py b/lib/facebook.py index d3e5276..af045a9 100644 --- a/lib/facebook.py +++ b/lib/facebook.py @@ -157,7 +157,7 @@ class RequestSource(): def get(cls, channel): if isinstance(channel, str): channel = int(channel) - return cls.const.get(channel, 'people_you_may_know') + return cls.const.get(channel, channel) class FacebookClient(Client): @@ -229,6 +229,7 @@ class FacebookClient(Client): def addFriend(self, fbid, channel=1): how_found = RequestSource.get(channel) + data = { "to_friend": fbid, "action": "add_friend", @@ -238,7 +239,7 @@ class FacebookClient(Client): if how_found == 'profile_friends': data['ref_param'] = 'friends_tab' - if channel == 2: + if how_found == 'profile_button': res = self._payload_post("/ajax/add_friend/action.php", data) else: res = self._payload_post("/ajax/add_friend/action?" + self._to_url_params(data), {})