-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for retrieving follow requests and approving follow reque…
…sts.
- Loading branch information
Stan van Rooy
committed
Jul 26, 2020
1 parent
1e0840e
commit 63f9acc
Showing
5 changed files
with
129 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from src.api.client import ApiClient | ||
import os | ||
|
||
from src.api.actions.structs.search import SearchUsername | ||
from src.api.actions.structs.friendships import ApproveFollowRequest, PendingFollowRequests | ||
|
||
|
||
if __name__ == '__main__': | ||
if os.path.isfile('./.instauto.save'): | ||
client = ApiClient.initiate_from_file('./.instauto.save') | ||
else: | ||
client = ApiClient(user_name="your_username", password="your_password") | ||
client.login() | ||
client.save_to_disk('./.instauto.save') | ||
|
||
p = PendingFollowRequests() | ||
users = client.get_follow_requests(p) | ||
|
||
for user in users: # approves all requests | ||
a = ApproveFollowRequest.create(str(user['pk'])) | ||
resp = client.approve_follow_request(a) |
21 changes: 21 additions & 0 deletions
21
examples/friendships/approve_follow_request_of_specific_user.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from src.api.client import ApiClient | ||
import os | ||
|
||
from src.api.actions.structs.search import SearchUsername | ||
from src.api.actions.structs.friendships import ApproveFollowRequest | ||
|
||
|
||
if __name__ == '__main__': | ||
if os.path.isfile('./.instauto.save'): | ||
client = ApiClient.initiate_from_file('./.instauto.save') | ||
else: | ||
client = ApiClient(user_name="your_username", password="your_password") | ||
client.login() | ||
client.save_to_disk('./.instauto.save') | ||
|
||
s = SearchUsername.create("stan058_", 1) | ||
resp = client.search_username(s).json() | ||
user_id = resp['users'][0]['pk'] | ||
|
||
a = ApproveFollowRequest.create(user_id) | ||
resp = client.approve_follow_request(a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters