Adding libraries to nxshell Jython?
-
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 -
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'} -
-
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