Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(self, params={}):
# Set variables
ip = params.get(Input.IP)
token = self.connection.token
server = self.connection.domain
# Check if token is provided and set correct URL
if token:
url = f"{server}{ip}/json?token={token}"
self.logger.info('API token was provided by user')
else:
url = f"{server}{ip}/json"
# Make request
request = requests.get(url)
dic = request.json()
return dic