-
Notifications
You must be signed in to change notification settings - Fork 5
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
🎉 Add ability to get user's phone number #85
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #85 +/- ##
===========================================
- Coverage 100.00% 99.44% -0.56%
===========================================
Files 15 15
Lines 538 543 +5
===========================================
+ Hits 538 540 +2
- Misses 0 3 +3
Continue to review full report at Codecov.
|
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.
LGTM in general.
Could you please add unit tests to cover this feature?
@@ -88,6 +88,18 @@ def media_count(self) -> int: | |||
""" | |||
return cast(int, self.user_detail()["media_count"]) | |||
|
|||
@property | |||
def get_phone_number(self) -> str: |
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_number
because it's a property and not a getter method.
detail = self.user_detail() | ||
phone_number = detail["public_phone_country_code"] + detail["public_phone_number"] | ||
|
||
return "+{}".format(phone_number) if phone_number else "" |
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.
Please, use an f-string instead of a string formatting.
detail = self.user_detail() | ||
phone_number = detail["public_phone_country_code"] + detail["public_phone_number"] | ||
|
||
return "+{}".format(phone_number) if phone_number else "" |
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.
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.
Summary:
Function for obtaining user's phone number was added. get_phone_number function returns phone number according to E.164 standard:
If user doesn't provide phone number, function will return empty string.
Closes #69