Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions instapi/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ def media_count(self) -> int:
"""
return cast(int, self.user_detail()["media_count"])

@property
def get_phone_number(self) -> str:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a better name will be phone_number because it's a property and not a getter method.

"""
Return user's phone number

:return: str
"""
detail = self.user_detail()
phone_number = detail["public_phone_country_code"] + detail["public_phone_number"]

return "+{}".format(phone_number) if phone_number else ""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use an f-string instead of a string formatting.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I don't like the idea of returning an empty string when phone number is not present, I would rather return None to show that the phone number is missed.


@property
def follower_count(self) -> int:
"""
Expand Down