Browse Source

Merge branch 'fix' into 'dev'

Fix

See merge request sun/pyfbx!7
fix
Laurent 3 years ago
parent
commit
7e6ec0e285
  1. 11
      pyfbx/__main__.py
  2. 18
      pyfbx/api.py
  3. 1
      pyfbx/client.py

11
pyfbx/__main__.py

@ -30,10 +30,13 @@ def main():
help="increase verbosity to INFO, use twice for DEBUG")
parser.add_argument("-n", "--http", action="store_true",
help="Disable MDNS and use http known address")
parser.add_argument("-u", "--url", type=str,
help="specific url to query",
default=None)
args = parser.parse_args()
console(log, log_level[min(2, args.verbose)])
try:
myfb = Fbx(nomdns=args.http)
myfb = Fbx(nomdns=args.http, url=args.url)
token = args.token
if token:
if token.startswith('f:'):
@ -47,5 +50,11 @@ def main():
myfb.mksession(app_id=args.app_id, token=token)
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(eval(f"myfb.{args.command}"))
return 0
except BaseException as err:
print(err)
return 2
if __name__ == "__main__":
exit(main())

18
pyfbx/api.py

@ -70,7 +70,7 @@ SYSTEMS = {
"Repair_a_file": _M("POST fs/repair/", "Repair a file", ["PostData"]),
"Hash_a_file": _M("POST fs/hash/", "Hash a file", ["PostData"]),
"Create_a_directory": _M("POST fs/mkdir/", "Create a directory", ["PostData"]),
"Rename_a_file/folder": _M("POST fs/rename/", "Rename a file/folder", ["PostData"]),
"Rename_a_file_folder": _M("POST fs/rename/", "Rename a file/folder", ["PostData"]),
"Download_a_file": _M("GET dl/{path}", "Download a file"),
},
"Share": {
@ -179,16 +179,16 @@ SYSTEMS = {
"Get_a_port_stats": _M("GET switch/port/{id}/stats", "Get a port stats"),
},
"Wifi": {
"Get_the_current_Wi-Fi_global_configuration": _M("GET wifi/config/", "Get the current Wi-Fi global configuration"),
"Update_the_Wi-Fi_global_configuration": _M("PUT wifi/config/", "Update the Wi-Fi global configuration", ["PostData"]),
"Wi-Fi_AP_API": _M("GET wifi/ap/", "Wi-Fi AP API"),
"Get_Wi-Fi_Stations_List": _M("GET wifi/ap/{id}/stations/", "Get Wi-Fi Stations List"),
"Wi-Fi_BSS_API": _M("GET wifi/bss/", "Wi-Fi BSS API"),
"Get_the_current_WiFi_global_configuration": _M("GET wifi/config/", "Get the current Wi-Fi global configuration"),
"Update_the_WiFi_global_configuration": _M("PUT wifi/config/", "Update the Wi-Fi global configuration", ["PostData"]),
"WiFi_AP_API": _M("GET wifi/ap/", "Wi-Fi AP API"),
"Get_WiFi_Stations_List": _M("GET wifi/ap/{id}/stations/", "Get Wi-Fi Stations List"),
"WiFi_BSS_API": _M("GET wifi/bss/", "Wi-Fi BSS API"),
"List_AP_neighbors": _M("GET wifi/ap/{id}/neighbors/", "List AP neighbors"),
"List_Wi-Fi_channels_usage": _M("GET wifi/ap/{id}/channel_usage/", "List Wi-Fi channels usage"),
"List_WiFi_channels_usage": _M("GET wifi/ap/{id}/channel_usage/", "List Wi-Fi channels usage"),
"Refresh_radar_informations": _M("POST wifi/ap/{id}/neighbors/scan", "Refresh radar informations", ["PostData"]),
"Get_Wi-Fi_Planning": _M("GET wifi/planning/", "Get Wi-Fi Planning"),
"Update_Wi-Fi_Planning": _M("PUT wifi/planning/", "Update Wi-Fi Planning", ["PostData"]),
"Get_WiFi_Planning": _M("GET wifi/planning/", "Get Wi-Fi Planning"),
"Update_WiFi_Planning": _M("PUT wifi/planning/", "Update Wi-Fi Planning", ["PostData"]),
"Get_the_MAC_filter_list": _M("GET wifi/mac_filter/", "Get the MAC filter list"),
"Getting_a_particular_MAC_filter": _M("GET wifi/mac_filter/{filter_id}", "Getting a particular MAC filter"),
"Updating_a_MAC_filter": _M("PUT wifi/mac_filter/{filter_id}", "Updating a MAC filter", ["PostData"]),

1
pyfbx/client.py

@ -7,7 +7,6 @@ import logging
import re
import hmac
import hashlib
import logging
import time
import requests
from . import api

Loading…
Cancel
Save