jbloomer / SnipeIT-PythonAPI

Python Interface to the SnipeIT (https://github.com/snipe/snipe-it) API
80 stars 37 forks source link

getDetailsByTag not working #15

Closed spgh-dev closed 3 years ago

spgh-dev commented 4 years ago

A typo in the AssetTag parameter is generating an exception

njtwiseman commented 4 years ago
def getDetailsByTag(self, server, token, **AssetTAG**):
        """Get asset details by ID

        Arguments:
            server {string} -- Server URI
            token {string} -- Token value to be used for accessing the API
            AssetTAG {string} -- Asset TAG             

        Returns:
            [string] -- Asset details from the server, in JSON formatted
        """
        self.uri = '/api/v1/hardware/bytag/' + str(**AssetTag**)
        self.server = server + self.uri
        headers = {'Authorization': 'Bearer ' + token}
        results = requests.get(self.server, headers=headers)
        return results.content
nesretep commented 4 years ago

This is still an issue. I pip installed the latest version today and the mismatched spelling of AssetTAG/AssetTag still exists.

File "C:\Users\path_goes_here\venv\lib\site-packages\snipeit\Assets.py", line 276, in getDetailsByTag self.uri = '/api/v1/hardware/bytag/' + str(AssetTag) NameError: name 'AssetTag' is not defined

rapgro commented 3 years ago

https://github.com/jbloomer/SnipeIT-PythonAPI/pull/21

jbloomer commented 3 years ago

Patch just merged