python arlo是一个用python 2.7/3x编写的库,它通过网站使用的api公开netgear arlo摄像头。
arlo的Python项目详细描述
爱洛
Python module for interacting with Netgear's Arlo camera system.
现在在高朗!
如果您喜欢go编程语言,请查看arlo-golang。 我的目标是尽快实现python版本的对等。如果您知道您在go中所做的工作,我将非常感谢您对图书馆的总体结构和贡献等方面的任何反馈。
这只是我出于需要而创造的个人效用。虽然它在一个易于使用的python包中公开了相当多的arlo接口,但它绝不是完整的。因此,这个包不附带单元测试(可以随意添加它们)或保证。 allcontributions欢迎并感谢!
如果您有要改进支持的特定爱洛设备,请考虑向我发送一个!由于这个项目完全由您维护,我没有无限的资金来支持它,我只能真正测试和调试代码与第一代爱洛摄像头和基站,我有。我也高度鼓励和感谢拉的要求!
请随意contribute购买此回购协议或给杰夫买杯啤酒!
慷慨的捐助者(谢谢!)
非常聪明的贡献者(谢谢!)
- m3ntalsp00n-2019年5月18日-扩展了arloq设备支持。
- burken--2019年4月17日-修复了Arloq设备的防护/解除防护。
- m0urs-2019年4月16日-已将fqdn更新为新的爱洛域。
- kimc78-2018年8月16日-添加了获取CVR记录列表的方法。
- jurgenweber-2018年4月25日-添加了爱洛婴儿API!
- pliablepixels-2018年4月3日-修复了自述文件的问题。
- manluk-2018年3月2日-压扁了几个虫子。
- notalifeform-2018年2月10日-修复了示例脚本中的错误和格式设置。
- erosen-2018年1月27日-在wiki中添加了arloq摄像机模式。
- deanmcguire-2017年12月7日-揭开了rtsp流媒体视频的神秘面纱。
- andijakl-2017年7月24日-添加了Python3支持并清理了示例。
- cemeyer2-2016年11月26日-修复了安装问题。
- LenShustek-2016年9月14日,-添加了logout()。
如果你想在这个世界上有所不同,并把你的名字列在最重要的名单上,看看我们的help wanted部分!
提交问题
在提交问题之前,请阅读Issue Guidelines and Policieswiki页面。谢谢。
安装
# Install latest stable package $ pip install arlo --or-- # Install from master branch $ pip install git+https://github.com/jeffreydwalter/arlo
注意1:my.arlo.com的API需要TLS 1.2。因此,如果您遇到ssl错误,很可能与您的openssl版本有关。您可能需要升级openssl库。
如果在OSX或MacOS上运行此库,则它们附带不支持TLS 1.2的openssl v0.9.x
。您应该按照here中的说明升级openssl库。
注意2:请确保除了sseclient 0.0.18
之外,您没有安装任何其他sseclient
软件包!这可能会导致此包以意外的方式失败。一个常见的导致问题的是sseclient-py 1.7
包。如果你有一个硬性要求有不止一个,请让我知道,我们可以考虑使工作。
安装完所有必需的库后,您可以像这样导入和使用此库:
fromarloimportArlofromdatetimeimporttimedelta,dateimportdatetimeimportsysUSERNAME='user@example.com'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.forrecordinginlibrary:videofilename=datetime.datetime.fromtimestamp(int(recording['name'])//1000).strftime('%Y-%m-%d %H-%M-%S')+' '+recording['uniqueId']+'.mp4'### 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('videos/'+videofilename, 'wb') as f:# f.write(video)# f.close()# Or:## Get video as a chunked stream; this function returns a generator.stream=arlo.StreamRecording(recording['presignedContentUrl'])withopen('videos/'+videofilename,'wb')asf:forchunkinstream:f.write(chunk)f.close()print('Downloaded video '+videofilename+' 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.')exceptExceptionase:print(e)
有关更多代码示例,请查看wiki