|
@@ -297,14 +297,14 @@ def main():
|
|
|
|
|
|
for port_range, switchport in switch.items():
|
|
|
ports = []
|
|
|
- if isinstance(port_range, int):
|
|
|
+ if isinstance(port_range, int) or port_range.isnumeric():
|
|
|
port_obj = SwitchPort(key=config["api_key"], id=port_range, dev=dev_obj)
|
|
|
ports.append(port_obj)
|
|
|
else:
|
|
|
prs = port_range.split(",")
|
|
|
for pr in prs:
|
|
|
pr = pr.strip()
|
|
|
- if isinstance(pr, int):
|
|
|
+ if pr.isnumeric():
|
|
|
port_obj = SwitchPort(key=config["api_key"], id=pr, dev=dev_obj)
|
|
|
ports.append(pr)
|
|
|
else:
|
|
@@ -316,7 +316,7 @@ def main():
|
|
|
(start, end) = pr.split("-")
|
|
|
start = start.strip()
|
|
|
end = end.strip()
|
|
|
- if not isinstance(start, int) or not isinstance(end, int):
|
|
|
+ if not start.isnumeric() or not end.isnumeric():
|
|
|
print(
|
|
|
"{}Error with port range '{}', {} and {} must be integers{}".format(
|
|
|
Fore.RED, pr, start, end, Style.RESET_ALL
|