Skip to content

Commit

Permalink
Merge pull request #31 from stanvanrooy/29_rename_showfollowing_and_s…
Browse files Browse the repository at this point in the history
…howfollowers

29: Rename `ShowFollowing` and `ShowFollowers`
  • Loading branch information
stanvanrooy committed Aug 29, 2020
2 parents ebb947f + 19d8b0b commit 74b5796
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ from instauto import friendships as fs
client = ApiClient(user_name="yourusername", password="yourpassword")
client.login()

f = fs.ShowFollowers.create(user_id="2283025667")
f = fs.GetFollowers.create(user_id="2283025667")
obj, result = client.followers_get(f) # grabs first page
while result: # paginates until all followers are extracted
parsed = result.json()
Expand Down
2 changes: 1 addition & 1 deletion examples/friendships/get_followers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
client.login()
client.save_to_disk('./.instauto.save')

f = fs.ShowFollowers.create(user_id="2283025667")
f = fs.GetFollowers.create(user_id="2283025667")
obj, result = client.followers_get(f) # grabs first page
while result: # paginates until all followers are extracted
parsed = result.json()
Expand Down
2 changes: 1 addition & 1 deletion examples/friendships/get_following.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
client.login()
client.save_to_disk('./.instauto.save')

f = fs.ShowFollowing.create(user_id="2283025667")
f = fs.GetFollowing.create(user_id="2283025667")
obj, result = client.following_get(f) # grabs the first page
while result: # paginate until all users are extracted
parsed = result.json()
Expand Down
10 changes: 5 additions & 5 deletions instauto/api/actions/friendships.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from requests import Session, Response
from typing import Union, Callable, Tuple, List
from .structs.friendships import Create, Destroy, Remove, Show, \
ShowFollowers, ShowFollowing, PendingRequests, ApproveRequest
GetFollowers, GetFollowing, PendingRequests, ApproveRequest
from ..structs import State, Method


Expand All @@ -27,12 +27,12 @@ def follower_show(self, obj: Show) -> Response:
# doesn't use _friendship_act, because it is a GET request.
return self._request(f"friendships/{obj.endpoint}/{obj.user_id}/", Method.GET)

def followers_get(self, obj: ShowFollowers) -> Tuple[ShowFollowers, Union[Response, bool]]:
def followers_get(self, obj: GetFollowers) -> Tuple[GetFollowers, Union[Response, bool]]:
"""Retrieves the followers of an Instagram user. Examples of how to use can be found in
examples/friendships/get_followers.py.
Returns
---------
ShowFollowers
GetFollowers
The object that was passed in as an argument, but with updated max_id and page attributes. DO NOT CHANGE
THOSE ATTRIBUTES.
Response || bool
Expand Down Expand Up @@ -81,12 +81,12 @@ def followers_get(self, obj: ShowFollowers) -> Tuple[ShowFollowers, Union[Respon
obj.page += 1
return obj, resp

def following_get(self, obj: ShowFollowing) -> Tuple[ShowFollowing, Union[Response, bool]]:
def following_get(self, obj: GetFollowing) -> Tuple[GetFollowing, Union[Response, bool]]:
"""Retrieves the following of an Instagram user. Examples of how to use can be found in
examples/friendships/get_following.py.
Returns
---------
ShowFollowers
GetFollowers
The object that was passed in as an argument, but with updated max_id and page attributes. DO NOT CHANGE
THOSE ATTRIBUTES.
Response || bool
Expand Down
2 changes: 1 addition & 1 deletion instauto/api/actions/structs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .post import Like, Unlike, Save, Post, Comment, UpdateCaption
from .friendships import ShowFollowing, ShowFollowers, Show, Remove, \
from .friendships import GetFollowing, GetFollowers, Show, Remove, \
Destroy, Create
from .profile import SetGender, SetBiography, Update
from .search import Username
8 changes: 4 additions & 4 deletions instauto/api/actions/structs/friendships.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,30 +99,30 @@ def create(cls, user_id: str) -> "Show":
return i


class ShowFollowers:
class GetFollowers:
user_id: str = None
page: int = 0
max_id: str = None
rank_token: str = None
search_surface: str = 'follow_list_page'

@classmethod
def create(cls, user_id: str) -> "ShowFollowers":
def create(cls, user_id: str) -> "GetFollowers":
i = cls()
i.user_id = user_id
i.rank_token = uuid.uuid4()
return i


class ShowFollowing:
class GetFollowing:
user_id: str = None
page: int = 0
max_id: str = None
rank_token: str = None
search_surface: str = 'follow_list_page'

@classmethod
def create(cls, user_id: str) -> "ShowFollowing":
def create(cls, user_id: str) -> "GetFollowing":
i = cls()
i.user_id = user_id
i.rank_token = uuid.uuid4()
Expand Down

0 comments on commit 74b5796

Please sign in to comment.