Skip to content

Commit

Permalink
Rename LoginFlow to PostLoginFlow and added uuids vars
Browse files Browse the repository at this point in the history
  • Loading branch information
adw0rd committed Nov 6, 2020
1 parent 1ddab8a commit faabcfc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
13 changes: 9 additions & 4 deletions instagrapi/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class PreLoginFlow:
def pre_login_flow(self) -> bool:
"""Эмуляция работы приложения до логина
"""Emulation mobile app behaivor before login
"""
# /api/v1/accounts/get_prefill_candidates
self.get_prefill_candidates(True)
Expand Down Expand Up @@ -76,9 +76,9 @@ def set_contact_point_prefill(self, usage: str = "prefill") -> dict:
return self.private_request("accounts/contact_point_prefill/", data, login=True)


class LoginFlow:
class PostLoginFlow:
def login_flow(self) -> bool:
"""Эмуляция работы приложения после логина
"""Emulation mobile app behaivor after login
"""
check_flow = []
chance = random.randint(1, 100) % 2 == 0
Expand Down Expand Up @@ -145,12 +145,17 @@ def get_reels_tray_feed(self, reason: str = "pull_to_refresh") -> dict:
return self.private_request("feed/reels_tray/", data)


class Login(PreLoginFlow, LoginFlow):
class Login(PreLoginFlow, PostLoginFlow):
username = None
password = None
last_login = None
relogin_attempt = 0
device_settings = {}
client_session_id = ""
advertising_id = ""
device_id = ""
phone_id = ""
uuid = ""

def init(self) -> bool:
if "cookies" in self.settings:
Expand Down
12 changes: 6 additions & 6 deletions instagrapi/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class Resource(BaseModel):
pk: int
video_url: Optional[HttpUrl] = '' # for Video and IGTV
video_url: Optional[HttpUrl] # for Video and IGTV
thumbnail_url: HttpUrl
media_type: int

Expand All @@ -21,15 +21,15 @@ class User(BaseModel):
follower_count: int
following_count: int
biography: Optional[str] = ''
external_url: Optional[HttpUrl] = ''
external_url: Optional[HttpUrl]
is_business: bool


class UserShort(BaseModel):
pk: int
username: str
full_name: Optional[str] = ''
profile_pic_url: Optional[HttpUrl] = ''
profile_pic_url: Optional[HttpUrl]
# is_private: bool
# is_verified: bool

Expand All @@ -49,7 +49,7 @@ class Location(BaseModel):
external_id: Optional[int]
external_id_source: Optional[str]
# address_json: Optional[dict] = {}
# profile_pic_url: Optional[HttpUrl] = ''
# profile_pic_url: Optional[HttpUrl]
# directory: Optional[dict] = {}


Expand All @@ -60,14 +60,14 @@ class Media(BaseModel):
taken_at: datetime
media_type: int
product_type: Optional[str] = '' # only for IGTV
thumbnail_url: Optional[HttpUrl] = ''
thumbnail_url: Optional[HttpUrl]
location: Optional[Location] = None
user: UserShort
comment_count: int
like_count: int
caption_text: str
usertags: List[Usertag]
video_url: Optional[HttpUrl] = '' # for Video and IGTV
video_url: Optional[HttpUrl] # for Video and IGTV
view_count: Optional[int] = 0 # for Video and IGTV
video_duration: Optional[float] = 0.0 # for Video and IGTV
title: Optional[str] = ''
Expand Down
2 changes: 1 addition & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def test_extract_media_album(self):
else:
self.assertEqual(getattr(video_resource, key), val)
for key, val in {
"video_url": "",
"video_url": None,
"thumbnail_url": "https://",
"media_type": 1,
"pk": 1787133803186894424,
Expand Down

0 comments on commit faabcfc

Please sign in to comment.