🎉 Add ability to get user's phone number#85
🎉 Add ability to get user's phone number#85opastushkov wants to merge 1 commit intouriyyo:developfrom
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.
|
uriyyo
left a comment
There was a problem hiding this comment.
LGTM in general.
Could you please add unit tests to cover this feature?
| return cast(int, self.user_detail()["media_count"]) | ||
|
|
||
| @property | ||
| def get_phone_number(self) -> str: |
There was a problem hiding this comment.
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.
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.
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