4 Replies Latest reply on Feb 19, 2018 6:33 AM by maryan.dmytriv

    IPAM python API query Error 403

    routerphreak

      I'm stuck troubleshooting an error with a python script authentication when querying an IPAM server.

      Looking for any guidance or suggestions on what to check next.

      Checked the forum, but none of the other resolutions for "Error 403" worked for me.

      Tried looking for logfile in "C:\Program Files (x86)\SolarWinds\Orion\Information Service\3.0" for troubleshooting, but no log file exists.

      The SWIS Query works in SWQL Studio using  ActiveDirectory credentials and OrionV3 Authenticattion.

       

      ## parameters

      - username is of the format domain\ADUser

      - npm_server is ip address of IPAM server

      - using Python 2.7.14

      - latest orionsdk-python

       

      ## Error received

      requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://a.b.c.d:17778/SolarWinds/InformationService/v3/Json/Query

       

      ## script

      import requests

      from orionsdk import SwisClient

      import getpass

       

      npm_server = 'a.b.c.d'

      username = raw_input('Username: ')

      password = getpass.getpass()

       

      verify = False

      if not verify:

          from requests.packages.urllib3.exceptions import InsecureRequestWarning

          requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

       

      swis = SwisClient(npm_server, username, password)

       

      addresses = swis.query('SELECT TOP 1 I.Status, I.DisplayName FROM IPAM.IPNode I WHERE Status=2 AND I.Subnet.DisplayName =''Server Rack One''')

      for address in addresses:

           print("Free IP Address is"+address.DisplayName)

       

      Thanks,

      Mike