Correction bug 2
This commit is contained in:
@ -47,7 +47,7 @@ class GLPIAPI:
|
|||||||
|
|
||||||
searchUri = f"{self.Server}/apirest.php/search/Computer?{search_parameter}"
|
searchUri = f"{self.Server}/apirest.php/search/Computer?{search_parameter}"
|
||||||
search = requests.get(searchUri, headers=self.Headers)
|
search = requests.get(searchUri, headers=self.Headers)
|
||||||
print(search.status_code)
|
|
||||||
if(search.status_code == 200):
|
if(search.status_code == 200):
|
||||||
search = search.json()
|
search = search.json()
|
||||||
if(search["totalcount"] == 1):
|
if(search["totalcount"] == 1):
|
||||||
@ -58,9 +58,8 @@ class GLPIAPI:
|
|||||||
elif(search["totalcount"] > 1):
|
elif(search["totalcount"] > 1):
|
||||||
deviceID = list(search["data"].keys())
|
deviceID = list(search["data"].keys())
|
||||||
return deviceID, search["data"], search["totalcount"]
|
return deviceID, search["data"], search["totalcount"]
|
||||||
else:
|
|
||||||
return "", "", 0
|
return None, None, 0
|
||||||
return "", "", 0
|
|
||||||
|
|
||||||
def GetUser(self, username=None, email=None):
|
def GetUser(self, username=None, email=None):
|
||||||
|
|
||||||
@ -80,8 +79,8 @@ class GLPIAPI:
|
|||||||
elif(search["totalcount"] > 1):
|
elif(search["totalcount"] > 1):
|
||||||
userID = list(search["data"].keys())
|
userID = list(search["data"].keys())
|
||||||
return userID, search["data"], search["totalcount"]
|
return userID, search["data"], search["totalcount"]
|
||||||
else:
|
|
||||||
return "", "", 0
|
return None, None, 0
|
||||||
|
|
||||||
def UpdateInventory(self, inventory):
|
def UpdateInventory(self, inventory):
|
||||||
headers = {
|
headers = {
|
||||||
|
|||||||
Reference in New Issue
Block a user