Last active
October 4, 2016 19:37
-
-
Save herrersystem/6c7969aef3076f9781df86ee92583fa1 to your computer and use it in GitHub Desktop.
Freebox OS API - See connected hosts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from apize.decorators import apize_raw | |
api_url = 'http://mafreebox.freebox.fr/api/v3' | |
@apize_raw(api_url + '/lan/browser/pub/') | |
def get_lan_host(session_token): | |
""" | |
http://dev.freebox.fr/sdk/os/lan/ | |
""" | |
headers = {'X-Fbx-App-Auth': session_token} | |
return {'headers': headers} | |
if __name__ == "__main__": | |
""" | |
To get session_token see: | |
https://gist.github.com/herrersystem/fbeea3c026fe225104edd9866dea2bac | |
""" | |
session_token = '<your_session_token>' | |
response = get_lan_host(session_token) | |
for host in response['data']['result']: | |
if not host['active']: | |
continue | |
#Name (Device type) | ip (mac). | |
print('{} ({}) | {} ({})'.format( | |
host['names'][0]['name'], | |
host['host_type'], | |
host['l3connectivities'][0]['addr'], | |
host['l2ident']['id'] | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment