Giter Club home page Giter Club logo

pyarlo's Introduction

arlo

Python module for interacting with Netgear's Arlo camera system.

This just a personal utility that I created out of necessity. It is by no means complete, although it does expose quite a bit of the Arlo interface in an easy to use Python pacakge.

As such, this package does not come with unit tests (feel free to add them) or guarantees.

I'm not a Python developer by trade and I don't plan on doing much more work on this library outside of fixing any bugs I find or adding any APIs I discover I need.

Please, feel free to contribute to this repo.

To get started, just do:

$ git clone https://github.com/jeffreydwalter/arlo.git

Once you have the repository cloned, you can import and use it, like so:

from datetime import timedelta, date
from Arlo import Arlo

USERNAME = '[email protected]'
PASSWORD = 'supersecretpassword'

try:
	# Instantiating the Arlo object automatically calls Login(), which returns an oAuth token that gets cached.
	# Subsequent successful calls to login will update the oAuth token.
	arlo = Arlo(USERNAME, PASSWORD)
	# At this point you're logged into Arlo.

	today = (date.today()-timedelta(days=0)).strftime("%Y%m%d")
	seven_days_ago = (date.today()-timedelta(days=7)).strftime("%Y%m%d")

	# Get all of the recordings for a date range.
	library = arlo.GetLibrary(seven_days_ago, today)

	# Iterate through the recordings in the library.
	for recording in library:

		##
		# The videos produced by Arlo are pretty small, even in their longest, best quality settings,
		# but you should probably prefer the chunked stream (see below). 
		###    
		#    # Download the whole video into memory as a single chunk.
		#    video = arlo.GetRecording(recording['presignedContentUrl'])
		#	 with open(recording['name']+'.mp4', 'w') as f:
		#        f.write(stream)
		#        f.close()
		# Or:
		#
		# Get video as a chunked stream; this function returns a generator.
		stream = arlo.StreamRecording(recording['presignedContentUrl'])
		with open(recording['name']+'.mp4', 'w') as f:
			for chunk in stream:
				f.write(chunk)
			f.close()

		print 'Downloaded video '+recording['name']+' from '+recording['createdDate']+'.'

	# Delete all of the videos you just downloaded from the Arlo library.
	# Notice that you can pass the "library" object we got back from the GetLibrary() call.
	result = arlo.BatchDeleteRecordings(library)

	# If we made it here without an exception, then the videos were successfully deleted.
	print 'Batch deletion of videos completed successfully.'

except Exception as e:
    print e

Here's an example of arming/disarming Arlo.

from Arlo.Arlo import Arlo

USERNAME = '[email protected]'
PASSWORD = 'supersecretpassword'

try:
	arlo = Arlo(USERNAME, PASSWORD)
	# At this point you're logged into Arlo.

	# Get the list of devices and filter on device type to only get the basestation.
	basestation = [ device for device in arlo.GetDevices() if device['deviceType'] == 'basestation' ]

	# Arm Arlo.
	arlo.Arm(basestation[0]['deviceId'], basestation[0]['xCloudId'])
	# Or
	# Disarm Arlo.
	# arlo.Disarm(basestation[0]['deviceId'], basestation[0]['xCloudId'])

except Exception as e:
    print e

Todo:

  • LICENSE
  • README
  • First pass at Arlo API in Python
  • Basic code example
  • Unit tests
  • Add missing APIs
  • Turn this into a proper pip package.
  • Add better documentation
  • Have a cold beer?

pyarlo's People

Contributors

jeffreydwalter avatar cemeyer2 avatar lenshustek avatar

Watchers

Alistair Galbraith avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.