βοΈ Client#
This page is about the client methods.
All the methods here are bound to to a
Me
instance.
from meapi import Me
me = Me(972123456789) # initialize the client
me.phone_search(972987654321)
me.get_profile('fdsfs-fdsfs-fdsfs-fdsfs')
me.get_socials()
me.get_settings()
me.get_groups()
π Search#
- Me.phone_search(phone_number: Union[str, int]) Optional[Contact] #
Get information on any phone number.
>>> res = me.phone_search(phone_number=972545416627) >>> res.name 'David'
- Parameters:
phone_number (
str
|int
) β International phone number format.- Raises:
SearchPassedLimit β if you passed the limit (About
350
per day in the unofficial auth method).- Returns:
Contact
object orNone
if no user exists on the provided phone number.- Return type:
Contact
|None
π Profile#
- Me.get_profile(uuid: Union[str, Contact, User]) Profile #
Get userβs profile.
For Me users (those who have registered in the app) there is an account
UUID
obtained when receiving information about the phone numberphone_search()
. With it, you can get social information and perform social actions.>>> p = me.get_profile(uuid='f7930d0f-c8ba-425b-8478-013968f30466') >>> print(p.name, p.email, p.profile_picture, p.gender, p.date_of_birth, p.slogan)
- Me.get_my_profile(only_limited_data: bool = False) Profile #
Get your profile information.
>>> p = me.get_my_profile() >>> p.as_dict() >>> p.as_vcard() >>> p.name = 'Changed Name' >>> p.email = 'john.doe@gmail.com'
- Me.update_profile_details(first_name: Optional[str] = False, last_name: Optional[str] = False, email: Optional[str] = False, gender: Optional[str] = False, slogan: Optional[str] = False, profile_picture: Optional[str] = False, date_of_birth: Optional[Union[str, datetime, date]] = False, location_name: Optional[str] = False, carrier: Optional[str] = False, device_type: Optional[str] = False, login_type: Optional[str] = False, facebook_url: Optional[Union[str, int]] = False, google_url: Optional[Union[str, int]] = False) Tuple[bool, Profile] #
- Update your profile details.
The default of the parameters is
False
. if you leave itFalse
, the parameter will not be updated.
Examples
>>> is_success, new_profile = me.update_profile_details(first_name='Chandler', last_name='Bing', date_of_birth='1968-04-08') >>> new_details = {'location_name': 'New York', 'gender': 'M'} >>> me.update_profile_details(**new_details) # dict unpacking (True, Profile(name='Chandler Bing', date_of_birth=datetime.date(1968, 4, 8), location_name='New York', gender='M', ...))
- Parameters:
first_name (
str
|None
) β First name.last_name (
str
|None
) β Last name.email (
str
|None
) β For example:user@domian.com
.gender (
str
|None
) βM
for male,F
for female.profile_picture (
str
|None
) β Direct image url or local image path. for example:https://example.com/image.png
,/home/david/Downloads/my_profile.jpg
.slogan (
str
|None
) β Your bio.date_of_birth (
str
|date
|datetime
|None
) β date/datetime obj or string withYYYY-MM-DD
format. for example:1994-09-22
.location_name (
str
|None
) β Your location, can be anything.login_type (
str
|None
) βemail
orapple
.device_type (
str
|None
) βandroid
orios
.carrier β The carrier of your phone. like
HOT-mobile
,AT&T
etc.facebook_url (
str
|int
|None
) β facebook id, for example:24898745174639
.google_url (
str
|int
|None
) β google id, for example:24898745174639
.
- Returns:
Tuple of: Is update success, new
Profile
object.- Return type:
Tuple[
bool
,Profile
]- Raises:
ValueError β If one of the parameters is not valid.
BlockedAccount β If your account is blocked for updating profile details.
π₯ Group names#
- Me.get_groups(sorted_by: str = 'count') List[Group] #
- Get groups of names and see how people named you.
>>> me.get_groups(sorted_by='count') [Group(name='Delivery Service', count=2, contacts=[User(name='David'...), User(name='John'...)]), ...]
- Parameters:
sorted_by (
str
) β Sort bycount
orlast_contact_at
. Default:count
.- Returns:
List of
Group
objects.- Return type:
List[
Group
]- Raises:
ValueError β If
sorted_by
is notcount
orlast_contact_at
.
- Me.get_deleted_groups() List[Group] #
Get group names that you deleted.
>>> me.get_deleted_groups() [Group(name='Delivery Service', count=2, contacts=[User(name='David'...), User(name='John'...)]), ...]
- Me.delete_group(contacts_ids: Union[Group, int, str, List[Union[int, str]]]) bool #
- Delete group name.
You can restore deleted group with
restore_name()
.You can also ask for rename with
ask_group_rename()
.
>>> me.delete_group(contacts_ids=me.get_groups()[0].contact_ids)
- Parameters:
contacts_ids (
Group
|int
|str
| List[int
,str
]) βGroup
object, single or list of contact ids from the same group. Seeget_groups()
.- Returns:
Is delete success.
- Return type:
bool
- Me.restore_group(contacts_ids: Union[int, str, List[Union[int, str]]]) bool #
- Restore deleted group from.
You can get deleted groups with
get_deleted_groups()
.
>>> me.restore_group(contacts_ids=me.get_deleted_groups()[0].contact_ids)
- Parameters:
contacts_ids (
Group
|int
|str
| List[int
,str
]) βGroup
object, single or list of contact ids from the same group. Seeget_groups()
.- Returns:
Is delete success.
- Return type:
bool
- Me.ask_group_rename(contacts_ids: Union[Group, int, str, List[Union[int, str]]], new_name: Optional[str] = None) bool #
Suggest new name to group of people and ask them to rename you in their contacts book.
>>> group = me.get_groups()[0] >>> group.name 'Delivery Service' >>> me.ask_group_rename(contacts_ids=group.contact_ids, new_name='Chandler Bing')
- Parameters:
contacts_ids (
Group
|int
|str
| List[int
,str
]) βGroup
object, single or list of contact ids from the same group. Seeget_groups()
.new_name (
str
|None
) β Suggested name, Default: Your profile name fromget_profile()
.
- Returns:
Is asking success.
- Return type:
bool
π€ Account#
- Me.get_uuid(phone_number: Union[int, str] = None) Optional[str] #
Get userβs uuid (To use in
get_profile()
,get_comments()
and more).>>> me.get_uuid(phone_number=972545416627) 'f7930d0f-c8ba-425b-8478-013968f30466'
- Parameters:
phone_number (
str
|int
|None
) β International phone number format. Default: None (Return self uuid).- Returns:
String of uuid, or None if no user exists on the provided phone number.
- Return type:
str
|None
- Me.get_saved_contacts() List[User] #
Get all the contacts stored in your contacts (Which has an Me account).
>>> saved_contacts = me.get_unsaved_contacts() >>> for usr in saved_contacts: print(usr.name)
- Returns:
List of saved contacts.
- Return type:
List[
User
]
- Me.get_unsaved_contacts() List[User] #
Get all the contacts that not stored in your contacts (Which has an Me account).
>>> unsaved_contacts = me.get_unsaved_contacts() >>> for usr in unsaved_contacts: print(usr.name)
- Returns:
List of unsaved contacts.
- Return type:
List[
User
]
- Me.block_profile(phone_number: Union[str, int], block_contact=True, me_full_block=True) BlockedNumber #
Block user profile.
>>> me.block_profile(phone_number=123456789, block_contact=True, me_full_block=False)
- Parameters:
phone_number (
str
|int
) β User phone number in international format.block_contact (
bool
) β To block for calls. Default:True
.me_full_block (
bool
) β To block for social. Default:True
.
- Returns:
BlockedNumber
object.- Return type:
- Me.unblock_profile(phone_number: int, unblock_contact=True, me_full_unblock=True) bool #
Unblock user profile.
>>> me.unblock_profile(phone_number=123456789, unblock_contact=True, me_full_unblock=False)
- Parameters:
phone_number (
str
|int
) β User phone number in international format.unblock_contact (
bool
) β To unblock for calls. Default:True
.me_full_unblock (
bool
) β To unblock for social. Default:True
.
- Returns:
Is successfully unblocked.
- Return type:
bool
- Me.block_numbers(numbers: Union[int, str, List[Union[int, str]]]) bool #
Block phone numbers.
>>> me.block_numbers(numbers=[123456789, 987654321])
- Parameters:
numbers (
int
|str
| List[int
|str
]) β Single or list of phone numbers in international format.- Returns:
Is blocked success.
- Return type:
bool
- Me.unblock_numbers(numbers: Union[int, List[int]]) bool #
Unblock numbers.
>>> me.unblock_numbers(numbers=[123456789, 987654321])
- Parameters:
numbers (
int
| List[int
]) β Single or list of phone numbers in international format. Seeget_blocked_numbers()
.- Returns:
Is unblocking success.
- Return type:
bool
- Me.get_blocked_numbers() List[BlockedNumber] #
Get list of your blocked numbers. See
unblock_numbers()
.>>> me.get_blocked_numbers() [BlockedNumber(phone_number=123456789, block_contact=True, me_full_block=True]
- Returns:
List of
blocked_number.BlockedNumber
objects.- Return type:
List[
BlockedNumber
]
- Me.upload_random_data(count: int = 50, contacts=False, calls=False, location=False) bool #
Upload random data to your account.
>>> me.upload_random_data(count=50, contacts=True, calls=True, location=True)
- Parameters:
count (
int
) β Count of random data to upload. Default:50
.contacts (
bool
) β To upload random contacts data. Default:False
.calls (
bool
) β To upload random calls data. Default:False
.location (
bool
) β To upload random location data. Default:False
.
- Returns:
Is uploading success.
- Return type:
bool
- Me.suspend_account(yes_im_sure: bool = False) bool #
Suspend your account until your next login.
>>> me.suspend_account(yes_im_sure=True)
- Parameters:
yes_im_sure (
bool
) βTrue
to suspend your account and ignore prompt. Default:False
.- Returns:
Is suspended.
- Return type:
bool
- Me.delete_account(yes_im_sure: bool = False) bool #
Delete your account and itβs data (!!!)
>>> me.delete_account(yes_im_sure=True) True
- Parameters:
yes_im_sure (
bool
) βTrue
to delete your account and ignore prompt. Default:False
.- Returns:
Is deleted.
- Return type:
bool
- Me.add_contacts(contacts: List[Dict[str, Optional[Union[str, int]]]]) dict #
Upload new contacts to your Me account. See
upload_random_data()
.>>> contacts = [{'country_code': 'XX', 'date_of_birth': None, 'name': 'Chandler', 'phone_number': 512145887}] >>> me.add_contacts(contacts=contacts)
- Parameters:
contacts (List[
dict
])) β List of dicts with contacts data.- Returns:
Dict with upload results.
- Return type:
dict
Example of list of contacts to add:
[ { "country_code": "XX", "date_of_birth": None, "name": "Chandler", "phone_number": 512145887, } ]
- Me.remove_contacts(contacts: List[Dict[str, Optional[Union[str, int]]]]) dict #
Remove contacts from your Me account.
>>> contacts = [{'country_code': 'XX', 'date_of_birth': None, 'name': 'Chandler', 'phone_number': 512145887}] >>> me.remove_contacts(contacts=contacts)
- Parameters:
contacts (List[
dict
]) β List of dicts with contacts data.- Returns:
Dict with upload results.
- Return type:
dict
Example of list of contacts to remove:
[ { "country_code": "XX", "date_of_birth": None, "name": "Chandler", "phone_number": 512145887, } ]
- Me.add_calls_to_log(calls: List[Dict[str, Optional[Union[str, int]]]]) List[Call] #
Add call to your calls log. See
upload_random_data()
.>>> calls = [{'called_at': '2021-07-29T11:27:50Z', 'duration': 28, 'name': '043437535', 'phone_number': 43437535, 'tag': None, 'type': 'missed'}] >>> me.add_calls_to_log(calls=calls)
- Parameters:
calls (List[
dict
]) β List of dicts with calls data.- Returns:
dict with upload result.
- Return type:
dict
Example of list of calls to add:
[ { "called_at": "2021-07-29T11:27:50Z", "duration": 28, "name": "043437535", "phone_number": 43437535, "tag": None, "type": "missed", } ]
- Me.remove_calls_from_log(calls: List[Dict[str, Optional[Union[str, int]]]]) List[Call] #
Remove calls from your calls log.
>>> calls = [{'called_at': '2021-07-29T11:27:50Z', 'duration': 28, 'name': '043437535', 'phone_number': 43437535, 'tag': None, 'type': 'missed'}] >>> me.remove_calls_from_log(calls=calls)
- Parameters:
calls (List[
dict
]) β List of dicts with calls data.- Returns:
dict with upload result.
- Return type:
dict
Example of list of calls to remove:
[ { "called_at": "2021-07-29T11:27:50Z", "duration": 28, "name": "043437535", "phone_number": 43437535, "tag": None, "type": "missed", } ]
π Location#
- Me.update_location(latitude: float, longitude: float) bool #
Update your location. See
upload_random_data()
.>>> me.update_location(35.6892, 51.3890)
- Parameters:
latitude (
float
) β location latitude coordinates.longitude (
float
) β location longitude coordinates.
- Returns:
Is location update success.
- Return type:
bool
- Raises:
ValueError β If latitude or longitude is not a float.
- Me.suggest_turn_on_location(uuid: Union[str, Profile, User, Contact]) bool #
Ask another user to share his location with you.
>>> me.suggest_turn_on_location('d4c7b2c0-5b5a-4b4b-9c1c-8c7b6a5b4c3d')
Share your location with another user.
>>> me.share_location('d4c7b2c0-5b5a-4b4b-9c1c-8c7b6a5b4c3d')
- Me.stop_sharing_location(uuids: Union[str, Profile, User, Contact, List[Union[str, Profile, User, Contact]]]) bool #
Stop sharing your
update_location()
with users.>>> me.stop_sharing_location('d4c7b2c0-5b5a-4b4b-9c1c-8c7b6a5b4c3d')
Stop locations that shared with you.
>>> me.stop_shared_location('d4c7b2c0-5b5a-4b4b-9c1c-8c7b6a5b4c3d')
Get list of users that you shared your location with them.
>>> me.locations_shared_by_me() [User(name='John Doe', uuid='d4c7b2c0-5b5a-4b4b-9c1c-8c7b6a5b4c3d', ...)]
π Notifications#
- Me.unread_notifications_count() int #
Get count of unread notifications.
>>> me.unread_notifications_count() 25
- Returns:
count of unread notifications.
- Return type:
int
- Me.get_notifications(page: int = 1, limit: int = 20, names_filter: bool = False, system_filter: bool = False, comments_filter: bool = False, who_watch_filter: bool = False, who_deleted_filter: bool = False, birthday_filter: bool = False, location_filter: bool = False) List[Notification] #
Get app notifications: new names, birthdays, comments, watches, deletes, location shares and system notifications.
>>> me.get_notifications(limit=300, names_filter=True, system_filter=True) [Notification(id=109, category='JOINED_ME', is_read=False, created_at=datetime.datetime(2020, 1, 1), ...),]
- Parameters:
page (
int
) βget_notifications()
.``count`` /page_size
. Default:1
.limit (
int
) β Limit of notifications in each page. Default:20
.names_filter (
bool
) β New names, deletes, joined, renames, rename requests. Default:False
.system_filter (
bool
) β System notifications: spam reports, your name requests, suggestions to turn on mutual contacts. Default:False
.comments_filter (
bool
) β Comments notifications: new comments, published comments and suggestions to turn on comments (Seeget_comments()
). Default:False
.who_watch_filter (
bool
) β Who watched your profile (Seewho_watched()
). Default:False
.who_deleted_filter (
bool
) β Who deleted you from his contacts (Seewho_deleted()
). Default:False
.birthday_filter (
bool
) β Contacts birthdays. Default:False
.location_filter (
bool
) β Shared locations: suggestions to turn on location, locations that shared with you. Default:False
.
- Returns:
List of
Notification
objects.- Return type:
List[
Notification
]
- Me.read_notification(notification_id: Union[int, str, Notification]) bool #
Mark notification as read.
>>> me.read_notification(109) True
- Parameters:
notification_id (
int
|str
|Notification
) β Notification id fromget_notifications()
orNotification
object.- Returns:
Is read success.
- Return type:
bool
βοΈSettings#
- Me.get_settings() Settings #
Get current settings.
>>> # Take control of your privacy: >>> my_settings = me.get_settings() >>> my_settings.who_watched_enabled = False >>> my_settings.who_deleted_enabled = False >>> my_settings.mutual_contacts_available = False >>> my_settings.comments_enabled = False >>> my_settings.location_enabled = False
- Me.change_settings(mutual_contacts_available: bool = None, who_watched_enabled: bool = None, who_deleted_enabled: bool = None, comments_enabled: bool = None, location_enabled: bool = None, language: str = None, who_deleted_notification_enabled: bool = None, who_watched_notification_enabled: bool = None, distance_notification_enabled: bool = None, system_notification_enabled: bool = None, birthday_notification_enabled: bool = None, comments_notification_enabled: bool = None, names_notification_enabled: bool = None, notifications_enabled: bool = None) Tuple[bool, Settings] #
Change social, app and notification settings.
>>> me.change_settings(language='en', mutual_contacts_available=False) (True, Settings(language='en', mutual_contacts_available=False, ...))
- Parameters:
mutual_contacts_available (
bool
) β Show common contacts between users. Default:None
.who_watched_enabled (
bool
) β Users will be notified that you have viewed their profile. Default:None
. - They will only be able to get information about you if they are premium users (is_premium
= True inget_profile()
) or, by usingmeapi
;) - This setting must be True if you want to usewho_watched()
method.who_deleted_enabled (
bool
) β Users will be notified that you have deleted them from your contact book. Default:None
. - They will only be able to get information about you if they are premium users (is_premium
=True
inget_profile()
) or, by usingmeapi
;) - This setting must beTrue
if you want to usewho_deleted()
method.comments_enabled (
bool
) β Allow users to publish comment (publish_comment()
) in your profile. Default:None
. - Comments will not be posted until you approve them withapprove_comment()
.location_enabled (
bool
) β Allow shared locations. Default:None
.language (
str
) β lang code:iw
,en
, etc. (For notifications text). Default:None
.who_deleted_notification_enabled (
bool
) β Default:None
.who_watched_notification_enabled (
bool
) β Default:None
.distance_notification_enabled (
bool
) β Default:None
.system_notification_enabled (
bool
) β Default:None
.birthday_notification_enabled (
bool
) β Default:None
.comments_notification_enabled (
bool
) β Default:None
.names_notification_enabled (
bool
) β Default:None
.notifications_enabled (
bool
) β Default:None
.
- Raises:
TypeError β If you donβt change any setting.
- Returns:
Tuple: Is success,
Settings
object.- Return type:
Tuple[
bool
,Settings
]
π© Advanced#
- Me.login(activation_code: Optional[str] = None, new_account_details: Optional[NewAccountDetails] = None, interactive_mode: bool = False) bool #
Login to MeApi.
If you initialized the
Me
class directly, this method will be called automatically. No need to call it.If
activation_code
is not provided andinteractive_mode
isTrue
the method will prompt for activation code.If the account is new and
new_account_details
is not provided andinteractive_mode
isTrue
the method will prompt for new account details.
- Parameters:
activation_code (
str
|None
) β You can pass the activation code if you want to skip the prompt. Default:None
.new_account_details (
NewAccountDetails
|None
) β You can pass the new account details if you want to skip the prompt in case of new account. Default:None
.interactive_mode (
bool
) β IfTrue
the method will prompt for activation code (and new account details in case of new account). Default:False
.
- Raises:
NeedActivationCode β If
activation_code
is not provided andinteractive_mode
isFalse
.IncorrectActivationCode β If the activation code is incorrect and
interactive_mode
isFalse
.ActivationCodeExpired β If the activation code is expired and
interactive_mode
isFalse
.MaxValidateReached β If
activation_code
is incorrect for a few times.NewAccountException β If the account is new and
new_account_details
is not provided andinteractive_mode
isFalse
.BrokenCredentialsManager β If the credentials manager is broken (if authentication succeeded but the credentials manager failed to save the credentials).
- Returns:
Is login succeeded.
- Return type:
bool
- Me.logout() bool #
- Logout from Me account (And delete credentials, depends on the credentials manager implementation).
If you want to login again, you need to call
login()
or create a new instance ofMe
.If you try to use any method that requires authentication, you will get a
NotLoggedIn
exception.
- Returns:
Is success.
- Type:
bool
- Me.make_request(method: Union[str, RequestType], endpoint: str, body: Dict[str, Any] = None, headers: Dict[str, Union[str, int]] = None, files: Dict[str, bytes] = None, max_retries: int = 3) Union[Dict[str, Any], List[Dict[str, Any]]] #
Make a raw request to Me API.
>>> me.make_request('GET', '/main/users/profile/me/') >>> me.make_request('PATCH', '/main/users/profile/', body={'name': 'Chandler Bing'})
- Parameters:
method (
str
|RequestType
) β Request method. Can beGET
,POST
,PUT
,DELETE
,PATCH
,HEAD
orOPTIONS
.endpoint (
str
) β API endpoint. e.g./main/users/profile/me/
.body (
dict
) β The body of the request. Default:None
.headers (
dict
) β Use different headers instead of the default ones. Default:None
.files (
dict
) β Files to send with the request. Default:None
.max_retries (
int
) β Maximum number of retries in case of failure. Default:3
.
- Raises:
MeApiException β If HTTP status is higher than 400.
ValueError β If the response received does not contain a valid JSON or the request type is not valid.
ConnectionError β If the request failed.
- Returns:
API response as dict or list.
- Return type:
dict
|list
π¬ Comments#
Call the method with no parameters to get comments in your profile.
uuid (
str
|User
|Profile
|Contact
) βuuid
of the user orProfile
,User
, orContact
objects. Default: Your uuid.List of
Comment
objects sorted by their like count.List[
Comment
]ValueError β In the official-auth-method mode you must to provide user uuid if you want to get your comments.
ContactHasNoUser β If you provide a contact object without user.
This methods return
Comment
object with justmessage
,like_count
andcomment_likes
atrrs.comment_id (
int
|str
) β Comment id fromget_comments()
.Comment
object.Comment
You can publish comment on your own profile or on someone elseβs profile.
When you publish comment on someone elseβs profile, the user need to approve your comment before it will be visible.
You can edit your comment by simple calling
publish_comment()
again. The comment status will be changed towaiting
until the user approves it.You can ask the user to enable comments in his profile with
suggest_turn_on_comments()
.If the user doesnβt enable comments (
comments_enabled
), or if he blocked you from comments (comments_blocked
), you will getNone
. You can get this info withget_profile()
.your_comment (
str
) β Your comment.uuid (
str
|Profile
|User
|Contact
) βuuid
of the user orProfile
,User
, orContact
objects. Default: Your uuid.add_credit (
bool
) β IfTrue
, this will add credit to the comment. Default:False
.Optional
Comment
object.Comment
|None
ContactHasNoUser β If you provide a contact object without user.
You can only approve comments that posted on your own profile.
You can always ignore it with
ignore_comment()
.You can approve delete it with
delete_comment()
.If the comment already approved, you get
True
anyway.comment_id (
str
|int
|Comment
) β Comment id fromget_comments()
. or justComment
object.Is approve success.
bool
you can always approve it with
approve_comment()
.)You can only ignore comments that posted on your own profile.
comment_id (
int
|str
|Comment
) β Comment id fromget_comments()
. or justComment
object.Is deleting success.
bool
You can only delete comments that posted on your own profile or that posted by you.
comment_id (
int
|str
|Comment
) β Comment id fromget_comments()
. or justComment
object.Is deleting success.
bool
If the comment is already liked, you get
True
anyway.If the comment not approved, you get
False
.comment_id (
int
|str
|Comment
) β Comment id fromget_comments()
. or justComment
object.Is like success.
bool
If the comment is already unliked, you get
True
anyway.If the comment not approved, you get
False
.comment_id (
int
|str
|Comment
) β Comment id fromget_comments()
. or justComment
object.Is unlike success.
bool
If the user is already blocked, you get
True
anyway.There is no apparent way to unblock comments. Use only when you are sure!
uuid (
str
|User
|Profile
|Contact
|Comment
) βuuid
of the user orProfile
,User
,Contact
orComment
objects.Is block success.
bool
ContactHasNoUser β If the contact object has no user.
Ask another user to turn on comments in his profile.
uuid (
str
|Profile
|User
|Contact
) βuuid
,Profile
,User
, orContact
of the commented user.Is request success.
bool
ContactHasNoUser β If you provide
Contact
without user.