Skip to content

Commit

Permalink
Updated some methods in compilance with ig 336.0.0.35.90
Browse files Browse the repository at this point in the history
  • Loading branch information
KolyaDobrydnev committed Jun 19, 2024
1 parent 3ef020f commit 89019cb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions instagrapi/mixins/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

try:
from typing import Literal

INFO_FROM_MODULE = Literal[INFO_FROM_MODULES]
except:
INFO_FROM_MODULE = str
Expand Down Expand Up @@ -231,7 +232,12 @@ def user_info_gql(self, user_id: str) -> User:
except JSONDecodeError as e:
raise ClientJSONDecodeError(e, user_id=user_id)

def user_info_v1(self, user_id: str, from_module: INFO_FROM_MODULE = "self_profile") -> User:
def user_info_v1(
self,
user_id: str,
from_module: INFO_FROM_MODULE = "self_profile",
is_app_start: bool = False,
) -> User:
"""
Get user object from user id
Expand All @@ -241,6 +247,8 @@ def user_info_v1(self, user_id: str, from_module: INFO_FROM_MODULE = "self_profi
User id of an instagram account
from_module: str
Which module triggered request: self_profile, feed_timeline, reel_feed_timeline. Default: self_profile
is_app_start: bool
Boolean value specifying if profile is being retrieved on app launch
Returns
-------
Expand All @@ -252,7 +260,8 @@ def user_info_v1(self, user_id: str, from_module: INFO_FROM_MODULE = "self_profi
params = {
"is_prefetch": "false",
"entry_point": "self_profile",
"from_module": from_module
"from_module": from_module,
"is_app_start": is_app_start,
}
assert (
from_module in INFO_FROM_MODULES
Expand Down Expand Up @@ -360,7 +369,10 @@ def user_friendship_v1(self, user_id: str) -> Relationship:
"""

try:
result = self.private_request(f"friendships/show/{user_id}/")
params = {
"is_external_deeplink_profile_view": "false",
}
result = self.private_request(f"friendships/show/{user_id}/", params=params)
assert result.get("status", "") == "ok"

return Relationship(user_id=user_id, **result)
Expand Down

0 comments on commit 89019cb

Please sign in to comment.