Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Adding libraries to nxshell Jython?

Adding libraries to nxshell Jython?

Scheduled Pinned Locked Moved Support
4 Posts 2 Posters 12.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z
    Z
    zshnet
    wrote on last edited by
    #1

    Hi all,

    I'd like to use the python library "requests" with Jython, but I can't seem to find where NetXMS installs it. Is it balled up in the nxshell Jar? Is there a way I could add libraries to Jython? I looked, and apparently requests is compatible with Jython.

    Thanks,
    Zach

    1 Reply Last reply
    0
    • A
      A
      Alex Kirhenshtein
      wrote on last edited by
      #2

      Like any  pure-python library, just add it to search path.

      mkdir c:\tmp
      cd c:\tmp
      git clone git://github.com/kennethreitz/requests.git
      java -jar nxshell-2.0.5.jar
      Server IP [127.0.0.1]:
      Login [admin]:
      Password [netxms]:
      NetXMS 2.0.5 Interactive Shell
      >>> import requests
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      ImportError: No module named requests
      >>> import sys
      >>> sys.path.append('c:\\tmp\\requests')
      >>> import requests
      >>> r = requests.get('https://www.netxms.org/')
      <Response [200]>
      >>> r.status_code
      200
      >>> r.headers
      {'Keep-Alive': 'timeout=15, max=100', 'Server': 'Apache/2.2.16 (Debian)', 'Connection': 'Keep-Alive', 'Date': 'Wed, 17 Aug 2016 14:06:34 GMT', 'Accept-Ranges': 'bytes', 'Content-Encoding': 'gzip', 'Vary': 'Accept-Encoding', 'Content-Length': '3237', 'Content-Type': 'text/html'}
      
      1 Reply Last reply
      0
      • Z
        Z
        zshnet
        wrote on last edited by
        #3

        Fancy! Thanks for the suggestion. I'll give it a shot.

        Thanks,
        Zach

        1 Reply Last reply
        0
        • Z
          Z
          zshnet
          wrote on last edited by
          #4

          Worked like a charm! Just had to change something in the python hmac_auth library because Jython is strongly typed, but otherwise it was no sweat.

          Thanks again for the help!

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          Powered by NodeBB Contributors
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups