与铃声通信的python库(https://ring.com/)
ring-doorbell的Python项目详细描述
python ring door bell是一个用python 2.7/3x编写的库 将ring.com设备公开为python对象。
当前ring.com不提供正式的api。这个项目的结果仅仅来自逆向工程。
文档:http://python-ring-doorbell.readthedocs.io/
安装
# Installing from PyPi $ pip install ring_doorbell # Installing latest development $ pip install \ git+https://github.com/tchellomello/python-ring-doorbell@master
初始化环形对象
fromring_doorbellimportRingmyring=Ring('foo@bar','secret')myring.is_connectedTrue
列出链接到您的帐户的设备
# All devicesmyring.devices{'chimes':[<RingChime:Downstairs>],'doorbells':[<RingDoorBell:FrontDoor>]}# All chimesmyring.chimes[<RingChime:Downstairs>]# All door bellsmyring.doorbells[<RingDoorBell:FrontDoor>]# All stickup camsmyring.stickup_cams[<RingStickUpCam:Driveway>]
使用属性和函数
fordevinlist(myring.stickup_cams+myring.chimes+myring.doorbells):# refresh datadev.update()print('Account ID: %s'%dev.account_id)print('Address: %s'%dev.address)print('Family: %s'%dev.family)print('ID: %s'%dev.id)print('Name: %s'%dev.name)print('Timezone: %s'%dev.timezone)print('Wifi Name: %s'%dev.wifi_name)print('Wifi RSSI: %s'%dev.wifi_signal_strength)# setting dev volumeprint('Volume: %s'%dev.volume)dev.volume=5print('Volume: %s'%dev.volume)# play dev test shoundifdev.family=='chimes':dev.test_sound(kind='ding')dev.test_sound(kind='motion')# turn on lights on floodlight camifdev.family=='stickup_cams'anddev.lights:dev.lights='on'
显示门铃事件
fordoorbellinmyring.doorbells:# listing the last 15 events of any kindforeventindoorbell.history(limit=15):print('ID: %s'%event['id'])print('Kind: %s'%event['kind'])print('Answered: %s'%event['answered'])print('When: %s'%event['created_at'])print('--'*50)# get a event list only the triggered by motionevents=doorbell.history(kind='motion')
下载丁触发的最后一个视频
doorbell=myring.doorbells[0]doorbell.recording_download(doorbell.history(limit=100,kind='ding')[0]['id'],filename='/home/user/last_ding.mp4',override=True)
显示上一个视频捕获URL
print(doorbell.recording_url(doorbell.last_recording_id))'https://ring-transcoded-videos.s3.amazonaws.com/99999999.mp4?X-Amz-Expires=3600&X-Amz-Date=20170313T232537Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=TOKEN_SECRET/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=secret'
如何贡献
请参见contribution.rst
积分和感谢
- 这个项目的灵感来源于https://github.com/jeroenmoors/php-ring-api。多谢杰罗恩莫斯。
- 一个叫Madbagger的人在Prism19进行他的初步研究(http://www.prism19.com/doorbot/second-pass-and-comm-reversing/)
- mitmproxy(https://mitmproxy.org/)的创建者伟大的http和https流量检查器
- @Mfussenegger在Mitmproxy和VirtualBox上的文章https://zignar.net/2015/12/31/sniffing-vbox-traffic-mitmproxy/
- 到允许我在kvm上安装android的项目http://www.android-x86.org/。