Esempio n. 1
0
def get_cam(user, passwd):
    d = Dropcam(user, passwd)
    cams = d.cameras()
    return cams[LIVING_ROOM_CAM]
Esempio n. 2
0
AWS_SECRET_ACCESS_KEY = payload['AWS_SECRET_ACCESS_KEY']
AWS_STORAGE_BUCKET_NAME = payload['AWS_STORAGE_BUCKET_NAME']


#Set up logger
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)

#connect to s3!
s3_connection = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
bucket_name = AWS_STORAGE_BUCKET_NAME
bucket = s3_connection.get_bucket(bucket_name)

#Let's do the magic
log.info('Logging into Dropcam')
dropcam = Dropcam(DROPCAM_USERNAME, DROPCAM_PASSWORD)
log.info("Grabbing cameras")
for camera in dropcam.cameras():
    log.info("Grabbing image from " + camera.title)
    filename = "camera " + str(camera.id) + " " + str(camera.title) + " " + str(datetime.datetime.now().strftime("%Y-%m-%d.%H:%M:%S"))
    filename = slugify(unicode(filename))
    full_path_filename = slugify(unicode(camera.title)) + "/" + str(datetime.datetime.now().strftime("%Y/%m/%d/")) + filename + ".jpg"
    key = bucket.new_key(full_path_filename)
    log.info("Downloading image")
    image_response = camera.get_image()
    fp = StringIO.StringIO(image_response.read())   # Wrap object
    log.info("Uploading image to s3")
    key.set_contents_from_file(fp)

log.info('Done pulling images')
Esempio n. 3
0
#!/usr/bin/python -u

#NOTE: using unbuffered IO with -u arg above

from dropcam import Dropcam
d = Dropcam("patchcam", "c1himera")
c = d.cameras()[0]
c.save_image("image.jpg")
Esempio n. 4
0
#!/usr/bin/python -u

#NOTE: using unbuffered IO with -u arg above


from dropcam import Dropcam
d = Dropcam("patchcam", "c1himera")
c = d.cameras()[0]
c.save_image("image.jpg")