brennerm / check-mk-web-api

Python library to talk to the Check_Mk Web API
https://brennerm.github.io/check-mk-web-api/
MIT License
53 stars 26 forks source link

python 2.7 import urllib.parse ImportError: No module named parse #26

Closed tdelov closed 3 years ago

tdelov commented 3 years ago

root@bbcd54098726:~# python --version Python 2.7.16 root@bbcd54098726:~# python test2.py Traceback (most recent call last): File "test2.py", line 5, in import check_mk_web_api File "/usr/local/lib/python2.7/site-packages/check_mk_web_api/init.py", line 6, in import urllib.parse ImportError: No module named parse

My script.

import check_mk_web_api
import os, ssl
if (not os.environ.get('PYTHONHTTPSVERIFY', '') and getattr(ssl, '_create_unverified_context', None)):
    ssl._create_default_https_context = ssl._create_unverified_context

myhostname = "myhost.domain.edu"
api = check_mk_web_api.WebApi('https://checkmk.domain.edu/manage/check_mk/webapi.py', username='automation', secret='123456')

myresult = api.get_host( myhostname , effective_attributes=True)
print ( myresult )
perlduck commented 3 years ago

I noticed that as well and added pull request #23 which fixes this. It is not yet included in the master branch.

brennerm commented 3 years ago

Fixed with #23. Will be part of the next release.

brennerm commented 3 years ago

Has been fixed with release 1.7.1.