Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dirty work around to make python 2.7.9 work for pyvmomi
diff --git a/samples/hello_world_vcenter.py b/samples/hello_world_vcenter.py
index 1320d05..eafa840 100755
--- a/samples/hello_world_vcenter.py
+++ b/samples/hello_world_vcenter.py
@@ -22,6 +22,19 @@ a friendly encouragement to joining the community!
import atexit
import argparse
import getpass
+import requests
+requests.packages.urllib3.disable_warnings()
+
+import ssl
+
+try:
+ _create_unverified_https_context = ssl._create_unverified_context
+except AttributeError:
+ # Legacy Python that doesn't verify HTTPS certificates by default
+ pass
+else:
+ # Handle target environment that doesn't support HTTPS verification
+ ssl._create_default_https_context = _create_unverified_https_context
from pyVim import connect
from pyVmomi import vmodl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.