예제 #1
0
def locate():
	iphone = FindMyIPhone(APPLE_EMAIL, APPLE_PASSWORD)
	iphone_location = iphone.locate()
	latitude = iphone_location.get('latitude')
	longitude = iphone_location.get('longitude')
	location = Location(latitude=latitude, longitude=longitude)
	db.session.add(location)
	db.session.commit()
def store_location():
    "Fetches an iPhone location from the Apple API and creates a Location Object"
    iphone = FindMyIPhone(APPLE_EMAIL, APPLE_PASSWORD)
    iphone_location = iphone.locate()

    location = Location()
    location.latitude = iphone_location.get('latitude')
    location.longitude = iphone_location.get('longitude')
    db.add(location)
    # Persist to the database
    db.commit()
    return location
예제 #3
0
def store_location():
    "Fetches an iPhone location from the Apple API and creates a Location Object"
    iDevices = FindMyIPhone(APPLE_EMAIL, APPLE_PASSWORD)
    # my phone is the 4th device (index 3) in the list
    iphone_location = iDevices.locate(device_num=3)

    location = Location()
    location.latitude = iphone_location.get('latitude')
    location.longitude = iphone_location.get('longitude')
    db.add(location)
    # Persist to the database
    db.commit()
    return location
예제 #4
0
import os
from findi import FindMyIPhone

# be careful storing your personal apple id in files. In this case we make it an environment variable

APPLE_EMAIL = os.environ.get("APPLE_EMAIL")
APPLE_PASSWORD = os.environ.get("APPLE_PASSWORD")

# initialize findmyiphone with your apple ID

iphone = FindMyIPhone(APPLE_EMAIL, APPLE_PASSWORD)

# locate the iphone

iphone_location = iphone.locate()

# iphone.locate() returns a dictionary that contains a latitude and longitude

latitude = iphone_location.get('latitude')
longitude = iphone_location.get('longitude')

print latitude, longitude
예제 #5
0
파일: record.py 프로젝트: alvinl/iTrack
import redis
import time

from findi import FindMyIPhone

# Get environment variables
REDIS_HOST = os.environ["REDIS_HOST"]
REDIS_PORT = int(os.environ["REDIS_PORT"])
REDIS_AUTH = os.environ["REDIS_AUTH"]
REDIS_DB = int(os.environ["REDIS_DB"])
APPLE_EMAIL = os.environ["APPLE_EMAIL"]
APPLE_PASSWORD = os.environ["APPLE_PASSWORD"]

# Connect to redis
r = redis.StrictRedis(host=REDIS_HOST,
                      port=REDIS_PORT,
                      db=REDIS_DB,
                      password=REDIS_AUTH)

iphone = FindMyIPhone(APPLE_EMAIL, APPLE_PASSWORD)

devices = [5]

for device in devices:
    iphone_location = iphone.locate(device_num=device, max_wait=20)
    latitude = iphone_location.get('latitude')
    longitude = iphone_location.get('longitude')
    location = "{'latitude': " + str(latitude) + ", 'longitude': " + str(
        longitude) + ", 'time': " + str(time.time()) + "}"
    r.lpush('location', location)