Skip to content

Instantly share code, notes, and snippets.

@michaelrice
Created May 7, 2015 19:53
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michaelrice/a6794a017e349fc65d01 to your computer and use it in GitHub Desktop.
Save michaelrice/a6794a017e349fc65d01 to your computer and use it in GitHub Desktop.
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