Created
February 5, 2014 08:22
-
-
Save calmh/8819249 to your computer and use it in GitHub Desktop.
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 | |
import argparse | |
from unifi.controller import Controller | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-c', '--controller', default='unifi', help='the controller address (default "unifi")') | |
parser.add_argument('-u', '--username', default='admin', help='the controller usernane (default("admin")') | |
parser.add_argument('-p', '--password', default='', help='the controller password') | |
parser.add_argument('-v', '--version', default='v2', help='the controller base version (default "v2")') | |
parser.add_argument('-s', '--siteid', default='default', help='the site ID, UniFi >=3.x only (default "default")') | |
parser.add_argument('aps', metavar='AP', type=str, nargs='+', help='Name of an AP') | |
args = parser.parse_args() | |
c = Controller(args.controller, args.username, args.password, args.version, args.siteid) | |
aps = c.get_aps() | |
print 'These AP:s exist:' | |
for ap in aps: | |
print ' - "%s"' % ap['name'] | |
for ap in args.aps: | |
print 'Rebooting: "%s"' % ap | |
c.restart_ap_name(ap) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works for me: