Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Revert "Obtain version on class init, allow compatibility with 2.x and 3.x APIs." #160

Merged
merged 1 commit into from
May 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 2 additions & 20 deletions ise.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import re
from furl import furl
from datetime import datetime, timedelta
from bs4 import BeautifulSoup

import requests

Expand Down Expand Up @@ -48,10 +47,9 @@ def __init__(self, ise_node, ers_user, ers_pass, verify=False, disable_warnings=
self.csrf_expires = None
self.timeout = timeout
self.ise.headers.update({'Connection': 'keep_alive'})

if self.disable_warnings:
requests.packages.urllib3.disable_warnings()
self.version = self.get_version()

@staticmethod
def _mac_test(mac):
Expand Down Expand Up @@ -142,22 +140,6 @@ def _request(self, url, method="get", data=None):

return req

def get_version(self):
try:
# Build MnT API URL
url = "https://" + self.ise_node + "/admin/API/mnt/Version"
# Access MnT API
req = self.ise.request('get', url, data=None, timeout=self.timeout)
# Extract version of first node
soup = BeautifulSoup(req.content,'xml')
full_version = soup.find_all('version')[0].get_text()
# Get simple version ie: 2.7
short_version = float(full_version[0:3])
# print("ISE Initializing - Version Check " + full_version)
return short_version
except:
return ""

def _get_groups(self, url, filter: str = None, size: int = 20, page: int = 1):
"""
Get generic group lists.
Expand Down Expand Up @@ -1419,4 +1401,4 @@ def delete_device(self, device):
result['error'] = 404
return result
else:
return ERS._pass_ersresponse(result, resp)
return ERS._pass_ersresponse(result, resp)
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ beautifulsoup4
furl
lxml
requests
beautifulsoup4
lxml