#!/usr/bin/env python from fbxtools.utils import get_url_api from fbxtools.fbx import Fbx url_api = get_url_api() app = Fbx(url_api) app.get_session_token() @app.api.call('/lcd/config') def get_config(): ''' GET /api/v3/lcd/config/ ''' return {} @app.api.call('/lcd/config', method='PUT') def update_config(config): ''' PUT /api/v3/lcd/config/ ''' return {'data': config, 'is_json': True} if __name__ == "__main__": new_config = { "brightness": 50, "orientation": 90, "orientation_forced": False }
#!/usr/bin/env python # -*- coding: utf8 -*- from fbxtools.fbx import Fbx from fbxtools.fbxo import Contact, Number, Email, Address, Url, Contacts, Calls, Call, Groups, Group, LanHost, LanHosts ## Initialize and connect app. app = Fbx('http://192.168.0.254/api/v3') app.get_session_token() def print_contact(app, id): contact = app.get_contact(id) print("\r\nContact Id: %s" % id) print(unicode(contact)) def print_number(app, id): number = app.get_number(id) print("\r\nNumber Id: %s" % id) print(unicode(number)) def print_address(app, id): address = app.get_address(id) print("\r\nAddress Id: %s" % id) print(unicode(address)) def print_email(app, id): email = app.get_email(id)
#!/usr/bin/env python from fbxtools.fbx import Fbx ## Initialize and connect app. app = Fbx('http://mafreebox.freebox.fr/api/v3') app.get_session_token() @app.api.call('/lcd/config') def get_config(): ''' GET /api/v3/lcd/config/ ''' return {} @app.api.call('/lcd/config', method='PUT') def update_config(config): ''' PUT /api/v3/lcd/config/ ''' return {'data': config, 'is_json': True} if __name__ == "__main__": new_config = { "brightness": 50, "orientation": 90, "orientation_forced": False }
#!/usr/bin/env python from fbxtools.fbx import Fbx ## Initialize and connect app. app = Fbx() app.get_session_token() @app.api.call('/lcd/config') def get_config(): ''' GET /api/v3/lcd/config/ ''' return {} @app.api.call('/lcd/config', method='PUT') def update_config(config): ''' PUT /api/v3/lcd/config/ ''' return {'data': config, 'is_json': True} if __name__ == "__main__": new_config = { "brightness": 50, "orientation": 90, "orientation_forced": False }
from fbxtools.fbx import Fbx import time import sys from flask import Flask from flask import request import subprocess import json import os # Globals FREEBOX_API_VERSION = 4 SERVER_PORT = 9876 server = Flask(__name__) app = Fbx('https://mafreebox.freebox.fr/api/v' + str(FREEBOX_API_VERSION)) doAuth = not os.path.exists(os.path.realpath('./') + '/app_auth.json') # Init (Optionnal) if doAuth: appToken, trackId = app.get_app_token() print(appToken) currentStatus = '' attempt = 5 while attempt > 0: time.sleep(3) response = app.track_auth_progress(trackId) if response['data']['success']: currentStatus = response['data']['result']['status'] if currentStatus == 'granted': print('[fbx] Your application got authorization !') break
#!/usr/bin/env python from fbxtools.utils import get_url_api from fbxtools.fbx import Fbx url_api = get_url_api() print url_api ## Initialize and connect app. app = Fbx('https://mafreebox.freebox.fr/api/v5', verify_cert=False) #app = Fbx(url_api) app.get_session_token() def main(): stls = app.staticleases #print(u'stls:',stls) for sl in stls: print(u'+++') print(u'mac: %s' % (str(sl.mac))) print(u'sl: %s' % (sl.__dict__)) print(u'id: %s' % (sl.id)) print(u'mac: %s' % (sl.mac)) print(u'ip %s:' % (sl.ip)) print(u'hostname: %s' % (sl.hostname)) print(u'host.vendor_name %s:' % (getattr(sl.host, u'vendor_name', u''))) print(u'host:\r\n--- %s\r\n--- \r\n' % (sl.host)) print(u'comment:%s ' % (sl.comment)) print(u'---')