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

How to approve user's follow request? #399

Open
5 of 6 tasks
VityaSchel opened this issue Sep 17, 2022 · 4 comments
Open
5 of 6 tasks

How to approve user's follow request? #399

VityaSchel opened this issue Sep 17, 2022 · 4 comments

Comments

@VityaSchel
Copy link

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • Read the questions carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (==> [x] no spaces).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.
  • Any mention of spam-like actions or spam-related tools/libs/etc is strictly not allowed.

Before submitting an issue, make sure you have:

  • Updated to the lastest version v1.6.0
  • Read the README and docs
  • Searched the bugtracker for similar issues including closed ones
  • Reviewed the sample code in tests and examples

Which client are you using?

  • app (instagram_private_api/)
  • web (instagram_web_api/)

Describe your Feature Request:

Well this is just ridiculous. In this library, there is a method to check incoming follow requests, but no way to approve it. In library with the same name but for javascript, there is a method to approve follow requests, but not to check list of them.

telegram-cloud-document-5-6138909705222751918

Please implement it! friendship_create just follows user, but does not approves its outgoing follow request. If such method exists, please add it to the documentation :)

@VityaSchel
Copy link
Author

Ah, of course, this library is dead and even if I wanted to do a PR, it would never be accepted by author who better add funding notice than fix bug.
I wonder if python has patch-package like js or I'll have to go back to dinosaurs and make a fork, edit it, and then clone to my project

@VityaSchel
Copy link
Author

VityaSchel commented Sep 17, 2022

Here is a patch file if you know how to use it:

--- friendships.py	2022-09-17 19:43:02.000000000 +0400
+++ /venv/lib/python3.9/site-packages/instagram_private_api/endpoints/friendships.py	2022-09-17 19:43:26.000000000 +0400
@@ -356,6 +356,20 @@
             params=params)
         return res
 
+    def approve_user(self, user_id):
+        """
+        Approve a user's follow request.
+
+        :param user_id:
+        :return:
+        """
+        params = {'user_id': user_id, 'radio_type': self.radio_type}
+        params.update(self.authenticated_params)
+        res = self._call_api(
+            'friendships/approve/{user_id!s}/'.format(**{'user_id': user_id}),
+            params=params)
+        return res
+
     def remove_follower(self, user_id):
         """
         Remove a follower.

And if you don't know, add this to (your lib folder)/instagram_private_api/endpoints/friendships.py:

    def approve_user(self, user_id):
        """
        Approve a user's follow request.

        :param user_id:
        :return:
        """
        params = {'user_id': user_id, 'radio_type': self.radio_type}
        params.update(self.authenticated_params)
        res = self._call_api(
            'friendships/approve/{user_id!s}/'.format(**{'user_id': user_id}),
            params=params)
        return res

@VityaSchel
Copy link
Author

Tested on Instagram app, works correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant