π Models#
πΉ Base model#
- class meapi.models.me_model.MeModel#
- Base class for all models.
Allow instances to be comparable, subscript, hashable, immutable (In some cases), and json serializable.
Examples
>>> my_profile = me.get_my_profile() # Get your profile. >>> my_profile.name # regular access >>> my_profile['name'] # subscript access >>> my_profile.get('name', default='') # safe access >>> my_profile.as_dict() # get all data as dict >>> my_profile.as_json() # get all data as json string >>> my_profile == other_profile # compare two objects
Methods:
- as_dict(only: Optional[Union[str, List[str]]] = None, exclude: Optional[Union[str, List[str]]] = None, recursive: bool = True) Dict[str, Any] #
Return class data as
dict
.Examples
>>> my_profile = me.get_my_profile() # Get your profile. >>> my_profile.as_dict() {'phone_number': 972123456789, 'first_name': 'David', 'last_name': 'Lev', 'socials': {'lin ...} >>> my_profile.as_dict(only=('phone_number', 'first_name'), recursive=False) {'phone_number': 972123456789, 'first_name': 'David'}
- Parameters:
only (
str
|list[str]
) β Return only the given keys.exclude (
str
|list[str]
) β Exclude the given keys.recursive (
bool
) β IfTrue
(default), return all nested objects as dict.
- as_json(only: Optional[Union[str, List[str]]] = None, exclude: Optional[Union[str, List[str]]] = None, recursive: bool = True, ensure_ascii: bool = False) str #
Return class data in
json
format.- Parameters:
only (
str
|list[str]
) β Return only the given keys.exclude (
str
|list[str]
) β Exclude the given keys.recursive (
bool
) β IfTrue
(default), return all nested objects as dict.ensure_ascii (
bool
) β IfTrue
, all non-ASCII characters in the output are escaped with\uXXXX
sequences.
- get(item: str, default: Optional[Any] = None)#
- Return the value of the attribute with the given name.
- Example:
>>> my_profile = me.get_my_profile() # Get your profile. >>> my_profile.get('phone_number')
- Parameters:
item (
str
) β The name of the attribute.default (
any
) β- The default value to return if the attribute does not exist.
Default:
None
- Returns:
The value of the attribute, or
default
if the attribute does not exist.
π Profile model#
- class meapi.models.profile.Profile#
- Represents the userβs profile. can also be used to update you profile details.
Modifiable attributes are marked with
modifiable
.For more information about the modifiable attributes, see
update_profile_details()
.
Example
>>> # Update your profile details. >>> my_profile = me.get_my_profile() >>> my_profile.name = "Chandler Bing" >>> my_profile.date_of_birth = "1968-04-08" >>> my_profile.slogan = "Hi, I'm Chandler. I make jokes when I'm uncomfortable." >>> my_profile.profile_picture = "/home/chandler/Downloads/my_profile.jpg"
- Parameters:
name (
str
optional, modifiable) β The userβs full name (first_name
+last_name
).first_name (
str
optional, modifiable) β The userβs first name.last_name (
str
optional, modifiable) β The userβs last name.profile_picture (
str
optional, modifiable) β The userβs profile picture url.slogan (
str
optional, modifiable) β The userβs bio.email (
str
optional, modifiable) β The userβs email.gender (
str
optional, modifiable) β The userβs gender:M
for male andF
for female.date_of_birth (
date
optional, modifiable) β The userβs date of birth.age (
int
) β The userβs age. calculated fromdate_of_birth
if exists, else0
.social (
Social
optional) β The userβs social media networks.phone_number (
int
) β The userβs phone number.uuid (
str
) β The userβs unique ID.phone_prefix (
str
) β The userβs phone prefix.device_type (
str
optional, modifiable) β The userβs device type:android
orios
.login_type (
str
optional, modifiable) β The userβs login type:email
orapple
.who_deleted_enabled (
bool
) β Whether the user can see who deleted him (Only ifis_premium
, Or if he usesmeapi
;).who_deleted (List[
Deleter
] optional) β The users who deleted him.who_watched_enabled (
bool
) β Whether the user can see who watched his profile (Only ifis_premium
, Or if he usesmeapi
;).who_watched (List[
Watcher
] optional) β The users who watched him.friends_distance (List[
User
] optional) β The users who shared their location with you.carrier (
str
optional, modifiable) β The userβs cell phone carrier.comments_enabled (
bool
) β Whether the user is allowing comments. You can ask the user to turn on comments withsuggest_turn_on_comments()
.comments_blocked (
bool
) β Whether the user blocked you from commenting on his profile.country_code (
str
) β The userβs two-letter country code.location_enabled (
bool
optional) β Whether the user is allowing location.is_shared_location (
bool
optional) β Whether the user is sharing their location with you. You can ask the user to share his location withsuggest_turn_on_location()
.share_location (
bool
optional) β Whether the user is sharing their location with you.distance (
float
optional) β The userβs distance from you.location_longitude (
float
optional) β The userβs location longitude coordinate.location_latitude (
float
optional) β The userβs location latitude coordinate.location_name (
str
optional, modifiable) β The userβs location name.is_he_blocked_me (
bool
optional) β- Whether the user has blocked you from seeing his profile (
me_full_block
, Seeblock_profile()
). If
True
, this profile will contain only the basic information, likename
,uuid
andphone_number
.
- Whether the user has blocked you from seeing his profile (
is_permanent (
bool
optional) β Whether the user is permanent.mutual_contacts_available (
bool
optional) β Whether the user has mutual contacts available. You can ask the user to turn on this feature withsuggest_turn_on_mutual()
.mutual_contacts (List[
MutualContact
] optional) β For more information about mutual contacts.is_premium (
bool
) β Whether the user is a premium user.is_verified (
bool
) β Whether the user is verified.gdpr_consent (
bool
) β Whether the user has given consent to the GDPR.facebook_url (
str
optional, modifiable) β The userβs Facebook ID.google_url (
str
optional, modifiable) β The userβs Google ID.me_in_contacts (
bool
optional) β Whether you are in the userβs contacts.user_type (
str
optional) β- The userβs type: the color of the user in the app:
BLUE
: Verified Caller ID from ME users (100% ID).GREEN
: Identified call with a very reliable result.YELLOW
: Uncertain Identification (Unverified).ORANGE
: No identification (can be reported).RED
: Spam calls.
verify_subscription (
bool
optional) β Whether the user has verified their subscription.
- Get friendship
- Get comments
- Get the profile as Vcard
- Block the profile
- Unblock this profile
- Report this profile as spam
π§ User model#
- class meapi.models.user.User#
- Represents a user.
A user is a person who log in to the app.
If you search a phone number with
phone_search()
, you will get a contact, but if this contact registered on the app, you get a user attribute.
- Parameters:
name (
str
) β The fullname of the user. combined withfirst_name
andlast_name
.first_name (
str
) β The first name of the user.last_name (
str
) β The last name of the user.uuid (
str
) β The unique identifier of the user. can be used to perform actions on the user.phone_number (
int
) β The phone number of the user.gender (
str
optional) β The gender of the user.M
for male,F
for female, andNone
if the user didnβt specify.email (
str
optional) β The email of the user.profile_picture (
str
optional) β Url to profile picture of the user.slogan (
str
optional) β The bio of the user.is_verified (
bool
optional) β Whether the user is verified (Has at least two social connected accounts).is_premium β Whether the user is paying for premium features (Like the ability to use who watch his profile, who deleted him from his contacts, no ads, and more).
- Get friendship
- Get comments
- Get the user as Vcard
- Block the user
- Unblock this user
- Report this user as spam
π€ Contact model#
- class meapi.models.contact.Contact#
Represents a contact.
- Parameters:
name (
str
) β The name of the contact.phone_number (
int
) β The phone number of the contact.id (
int
) β The id of the contact.picture (
str
optional) β The url picture of the contact.user (
User
optional) β The user of the contact. if the user register on the app.suggested_as_spam (
int
optional) β The number of times the contact has been suggested as spam.user_type (
str
optional) β- The userβs type: the color of the user in the app:
BLUE
: Verified Caller ID from ME users (100% ID).GREEN
: Identified call with a very reliable result.YELLOW
: Uncertain Identification (Unverified).ORANGE
: No identification (can be reported).RED
: Spam calls.
is_permanent (
bool
optional) β Whether the contact is permanent.is_pending_name_change (
bool
optional) β Whether the contact is pending name change.cached (
bool
optional) β Whether the results from the api is cached.is_shared_location (
bool
optional) β Whether the contact is shared location.created_at (
datetime
optional) β The date of the contact creation.modified_at (
datetime
optional) β The date of the contact modification.in_contact_list (
bool
optional) β Whether the contact is in the contact list.is_my_contact (
bool
optional) β Whether the contact is my contact.
- Get friendship
- Get comments
- Get the contact as Vcard
- Block this contact
- Unblock this contact
- Report this contact as spam
π€² Common model#
- class meapi.models.common._CommonMethodsForUserContactProfile#
Common methods for
Profile
,User
andContact
.- as_vcard(prefix_name: str = '', dl_profile_picture: bool = False, **kwargs) str #
Get contact data in vcard format in order to add it to your contacts book.
- Usage examples:
# Get your profile as vcard my_profile = me.get_my_profile() print(my_profile.as_vcard(twitter='social.twitter.profile_id', gender='gender') # Save profiles as vcard file uuids = ['xx-xx-xx-xx', 'yy-yy-yy-yy', 'zz-zz-zz-zz'] profiles = [me.get_profile(uuid) for uuid in uuids] # can raise rate limit exception. vcards = [profile.as_vcard(prefix_name="Imported", dl_profile_picture=False, location='location_name') for profile in profiles] with open('contacts.vcf', 'w') as contacts: contacts.write('\n'.join(vcards))
- Parameters:
prefix_name β (
str
): If you want to add prefix to the name of the contact, likeMr.
,Mrs.
,Imported
etc. Default: empty string""
.dl_profile_picture β (
bool
): If you want to download and add profile picture to the vcard (if available). Default:False
.kwargs β
- Add any other data to the
notes
field of the vcard. The key must be, of course, exists in the object as attr eith value ofstr
orint
. For example, if you want to add a gender information to the contact, you can pass the parameter
gender='gender'
The key uses as the title in the notes (you name it as you like), and the value is the attribute name of the object.
You can go even deeper: if Profile object provided, you may want to do something like
twitter='social.twitter.profile_id'
.No exception will be raised if the key doesnβt exist.
- Add any other data to the
- Returns:
Vcard format as string. See Wikipedia for more information.
- Return type:
str
Results example:
BEGIN:VCARD VERSION:3.0 FN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:Rachel Green TEL;CELL:1234567890 PHOTO;ENCODING=BASE64;JPEG:/9j/4AAQSgyIR.......... EMAIL:rachelg@friends.tv BDAY:1969-05-05 NOTE;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:Twitter: RachelGreeen | Gender: F END:VCARD
- block(block_contact=True, me_full_block=True) bool #
Block a contact.
- Parameters:
block_contact β (
bool
): If you want to block the contact from calls. Default:True
.me_full_block β (
bool
): If you want to block the contact from Me platform. Default:True
.
- Returns:
True
if the contact was blocked successfully, elseFalse
.- Return type:
bool
- Raises:
TypeError β If you try to block yourself.
- friendship() Friendship #
Returns the friendship status of the contact.
- Returns:
True
if the contact is your friend, elseFalse
.- Return type:
bool
- get_comments() List[Comment] #
Returns the comments of the contact.
- Returns:
The comments of the contact.
- Return type:
List[
Comment
]
- get_profile() Optional[Profile] #
Returns the profile of the contact.
- Returns:
The profile of the contact or
None
if the contact has no user.- Return type:
Profile
|None
- report_spam(spam_name: str, country_code: str) bool #
- Report this contact as spam.
The same as
report_spam()
.
- Parameters:
spam_name β (
str
): Name of the spammer.country_code β (
str
): Country code of the spammer.
- Returns:
True
if the contact was reported successfully, elseFalse
.- Return type:
bool
- unblock(unblock_contact=True, me_full_unblock=True) bool #
Unblock a contact.
- Parameters:
unblock_contact β (
bool
): If you want to unblock the contact from calls. Default:True
.me_full_unblock β (
bool
): If you want to unblock the contact from Me platform. Default:True
.
- Returns:
True
if the contact was unblocked successfully, elseFalse
.- Return type:
bool
- Raises:
TypeError β If you try to unblock yourself.
π₯ Group model#
- class meapi.models.group.Group#
- Represents a group of users that save you in their contact list in the same name
Examples
>>> my_groups = me.get_groups() >>> group = my_groups[0] >>> group.name 'Phoebe Buffay' >>> group.count 6 >>> group.last_contact_at datetime.datetime(2004, 5, 6, 21, 0) >>> group.ask_to_rename(new_name='Regina Phalange')
- Parameters:
name (
str
) β The name of the group, how your number saved in their contact list.count (
int
) β The number of users in the group.last_contact_at (
datetime
optional) β The last time that you saved in someoneβs contact list.contacts (List[
User
]) β The users that are in the group.contact_ids (
List[int]
) β The ids of the users that are in the group.is_active (
bool
) β Is the group active. - You can usedelete()
to hide the group andrestore()
to restore it.
Methods:
- delete() bool #
- Deletes the group.
The same as
delete_group()
.You get
True
even if the group is already hidden.
- Returns:
True
if the group was deleted,False
otherwise.- Return type:
bool
- restore() bool #
- Restores the group.
The same as
restore_group()
.You get
True
even if the group is already active.
- Returns:
True
if the group was restored,False
otherwise.- Return type:
bool
- ask_to_rename(new_name) bool #
- Asks from the users in the group to rename you in their contact list.
The same as
ask_group_rename()
.You canβt adk rename a group if itβs hidden (
is_active=False
).
- Parameters:
new_name (
str
) β The new name that you want them to rename you in their contact list.- Returns:
True
if the suggested send,False
otherwise.- Return type:
bool
π Watcher model#
- class meapi.models.watcher.Watcher#
- Represents a Watcher, user who watch your profile.
Examples
>>> my_watchers = me.who_watched() >>> watcher = my_watchers[0] >>> watcher.user.name 'Mike Hannigan' >>> watcher.count 15 >>> me.publish_comment(uuid=watcher.user,your_comment="So, what are your intentions with my Phoebe?") <Comment id=321 status=waiting msg=o, what are your intentions with my Phoebe? author=Joey Tribbiani>
- Parameters:
last_view (
datetime
) β Date of last view.user (
User
) β The user who watch your profile.count (
int
) β The number of views.is_search (
bool
) β Whether the user is searching your profile.
β Deleter model#
- class meapi.models.deleter.Deleter#
- Represents a Deleter, user who delete you from his contacts.
Examples
>>> my_deleters = me.who_deleted() >>> deleter = my_deleters[0] >>> deleter.user.name 'Janine Lecroix' >>> me.publish_comment(uuid=deleter.user,your_comment="How You Doin'?") <Comment id=456 status=waiting msg=How You Doin'? author=Joey Tribbiani>
- Parameters:
created_at (
str
) β Date of delete.user (
User
) β User who delete you.
π€ Friendship model#
- class meapi.models.friendship.Friendship#
- Represents a Friendship.
Friendship is a relationship between you and another user.
Examples
>>> janice_and_i = me.friendship(phone_number=1969030000000) >>> janice_and_i.he_named 'Little bingaling' >>> janice_and_i.i_named 'Oh. My. God.' >>> janice_and_i.his_comment 'You're my little love muffin' >>> janice_and_i.my_comment 'I seek you out!
- Parameters:
calls_duration (
int
) β The duration of your calls in seconds.he_called (
int
) β The number of times the other user has called you.i_called (
int
) β The number of times you have called the other user.he_named (
str
) β How the other user named you in his contacts book.i_named (
str
) β How you named the other user in your contacts book.he_watched (
int
) β The number of times the other user has watched your profile.his_comment (
str
) β The comment the other user has comment on your profile.my_comment (
str
optional) β The comment you have comment on the other userβs profile.i_watched (
int
) β The number of times you have watched the other userβs profile.mutual_friends_count (
int
) β The number of mutual contacts between you and the other user.is_premium (
bool
) β Whether the other user is a premium user.
π Notification model#
- class meapi.models.notification.Notification#
- Represents a Notification from the app.
Notification could be new comment, new profile watch, new deleted, contact birthday, suggestion, etc.
Examples
>>> my_notifications = me.get_notifications() >>> notification = my_notifications[0][0] >>> notification.category 'UPDATED_CONTACT' >>> notification.name 'Mike Hannigan' >>> notification.new_name 'Princess Consuela Banana-Hammock' >>> me.publish_comment(uuid=notification.uuid,your_comment="Hi *** bag!") <Comment id=678 status=waiting msg=Hi *** bag! author=Phoebe Buffay>
- Parameters:
id (
int
) β The id of the notification.created_at (datetime`) β Date of creation.
modified_at (datetime`) β Date of last modification.
is_read (
bool
) β Whether the notification is read.sender (
str
) β UUID of the sender of the notification.status (
str
) β Status of the notification.delivery_method (
str
) β Delivery method of the notification. Most likelypush
.distribution_date (
datetime
) β Date of distribution.category (
str
) β Category of the notification.message_lang (
str
) β Language of the notification,en
,he
etc.message_subject (
str
optional) β Subject of the notification.message_body (
str
optional) β Body of the notification.context (
dict
optional) β The context of the notification: name, uuid, new_name, tag, profile_picture and more.
Methods:
- read() bool #
- Mark the notification as read.
The same as
read_notification()
.
- Returns:
Whether the notification was marked as read.
- Return type:
bool
βοΈ Settings model#
- class meapi.models.settings.Settings#
- Manage your social, notification and app settings.
You can edit your settings by simply assigning a new value to the attribute.
Modifiable attributes are marked with
modifiable
.For more information about the modifiable attributes, see
change_settings()
.
Example
>>> # 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
- Parameters:
who_deleted_enabled (
bool
modifiable) β- If
True
, other users can see if you deleted them from your contact book The users can see it only if they
is_premium
users, or by usingmeapi
;)Must be enabled in order to use
who_deleted()
.
- If
who_watched_enabled (
bool
modifiable) β- If
True
, other users can see if you watch their profile. The users can see it only if they
is_premium
users, or by usingmeapi
;)Must be enabled in order to use
who_watched()
.
- If
comments_enabled (
bool
modifiable) β- Allow other users to
publish_comment()
on your profile. You always need to
approve_comment()
before they are published.You can block spesfic users from commenting on your profile with
block_comments()
.
- Allow other users to
location_enabled (
bool
modifiable) β Allow other users ask to see your location.mutual_contacts_available (
bool
modifiable) β- If
True
, other users can see your mutual contacts. See
friendship()
for more information.
- If
notifications_enabled (
bool
modifiable) β- Get notify on new messages.
See
get_notifications()
for more information.
who_deleted_notification_enabled (
bool
modifiable) β- Get notify on who deleted you from your contact book.
You will only receive notifications if
who_deleted_enabled
isTrue
.
who_watched_notification_enabled (
bool
modifiable) β- Get notify on who watched your profile.
You will only receive notifications if
who_watched_enabled
isTrue
.
comments_notification_enabled (
bool
modifiable) β- Get notify on new comments, likes etc.
You will only receive notifications if
comments_enabled
isTrue
.
birthday_notification_enabled (
bool
modifiable) β Get notify on contact birthday.distance_notification_enabled (
bool
modifiable) β Get notify on contacts distance.names_notification_enabled (
bool
modifiable) β Get notify when someone saved you in is contacts book, new joined contacts to Me, new rename approve and more.system_notification_enabled (
bool
modifiable) β Get notify on system messages: spam reports, mutual requests and more.contact_suspended (
bool
) β If True, the contact is suspended.language (
str
modifiable) β Language of the notifications.last_backup_at (
datetime
optional) β Last backup time.last_restore_at (
datetime
optional) β Last restore time.spammers_count (
int
) β Number of spammers.
π« BlockedNumber model#
- class meapi.models.blocked_number.BlockedNumber#
- Represents a blocked number.
Example
>>> from meapi import Me >>> blocked_numbers = Me.get_blocked_numbers() >>> for blocked_number in blocked_numbers: blocked_number.unblock()
- Parameters:
block_contact (
bool
) β This contact cannot call or text you.me_full_block (
bool
) β This contact cannot watch yourMe
profile (And neither will you be able to view his).phone_number (
int
) β The phone number of the contact.
π MutualContact model#
- class meapi.models.mutual_contact.MutualContact#
Represents a Mutual contact between you and another user.
- Parameters:
name (
str
) β The userβs fullname.phone_number (
int
) β The userβs phone number.date_of_birth (
date
) β The userβs date of birth.uuid (
str
optional) β The userβs unique ID.
- Get the contact as Vcard
- Block this contact
- Unblock this contact
- Report this contact as spam
π Others#
- class meapi.models.others.NewAccountDetails#
Account details for new account registration.
- Parameters:
first_name (
str
) β First name to use.last_name (
str
|None
) β Last name to use. Default:None
.email (
str
|None
) β Email to use. Default:None
.
- class meapi.models.others.Call#
- class meapi.models.others.Contact#
- class meapi.models.others.CallType#
Call type enum.
- class meapi.models.others.RequestType#
Request type enum.
π¬ Comment model#
Represents a comment.
Examples
message (
str
) β The message of the comment.id (
int
) β The id of the comment.status (
str
) β The status of the comment:approved
,ignored
,waiting
,deleted
.author (
User
) β The creator of the comment.like_count (
int
) β The number of likes of the comment.comment_likes (
list
ofUser
) β The list of users who liked the comment.created_at (
datetime
|None
) β The date of the comment creation.is_liked (
bool
) β Whether the creator liked his comment.comments_blocked (
bool
) β Whether the user blocked the comments of the comment.Methods:
You can only approve comments that posted by others on your own profile.
The same as
approve_comment()
.Is approve success.
bool
You can only edit comments that posted by you.
The same as
publish_comment()
.new_msg (
str
) β The new message of the comment.remove_credit (
bool
) β Whether to remove the credit tomeapi
from the comment.Is edit success.
bool
You can only ignore and hide comments that posted by others on your own profile.
The same as
ignore_comment()
.Is ignore success.
bool
You can only delete comments that posted on your own profile or by you.
The same as
delete_comment()
.Is delete success.
bool
The same as
like_comment()
.Is like success.
bool
The same as
unlike_comment()
.Is unlike success.
bool
The same as
publish_comment()
.if you already replied to the comment, this will edit the comment like
edit()
.your_comment (
str
) β The message of the comment.The new comment.
Comment
The same as
block_comments()
.This will not delete the comment. It will just block the author from editing or posting comments on your profile.
Is block success.
bool