-
Notifications
You must be signed in to change notification settings - Fork 6
🎉 Add ability to get user's phone number #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,18 @@ def media_count(self) -> int: | |
| """ | ||
| return cast(int, self.user_detail()["media_count"]) | ||
|
|
||
| @property | ||
| def get_phone_number(self) -> str: | ||
| """ | ||
| 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 "" | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, use an f-string instead of a string formatting.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| @property | ||
| def follower_count(self) -> int: | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
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_numberbecause it's a property and not a getter method.