|Clay Shieh d03eea3dbe||2 years ago|
|FMF.py||2 years ago|
|README.md||2 years ago|
FindMyFriends API intended to be used for server side applications written using requests and iCloud.com
The only non standard Python Library you need is requests which you can install by running
pip install requests
Import FMF into your Python file by including the following line
Initialize the client with your apple ID login which should be your email and password.
f = FMF("firstname.lastname@example.org", "password")
When you want to refresh the location status of all your Find My Friend contacts, call the
You can also specify the number of minimum attempts (to get a more accurate reading), the maximum number of attempts (to prevent significant delays) and the wait time (in seconds) between each attempt to avoid spamming Apple servers. The default settings that I’ve personally found to be good enough are as follows: 2 minimum attempts, 7 maximum attempts and a 3 second wait time.
When you want to get the location data of a contact use the
get_user_by_name() method with the contact’s contact name as it appears in your contacts.
the api currently does not play well with contacts with emoji’s in the name so an alternative method to find the contact is provided,
You can also specify a function with the optional
hook argument to do something with the user’s name and the returned data. For example if you are using a SMS Api that has a
text() function, if you set
hook=text then it will execute
text(user, result) where user is the contact name of the person you are trying to find and result is the data of said user’s current location information.
I initially referenced Vladimir Smirnov’s iCloud API for general iCloud workflow and cookie implementation which can be found here
I have sinced changed the code significantly for my own use and changed to using requests instead of httplib2 as it is better supported. Thanks!
Pull requests and contributions are welcomed!
For any questions or concerns, please create an issue or contact me.