If you want to get a complete list of Python modules available on your web host, you can do so with the following code:
#!/usr/bin/python import os print "Content-type: text/html\n\n"; print "<html><head></head>" print "<body bgcolor='#ffffff'>" print "\n<BR><b>Available Modules:</b><BR>" # List all installed packages print '<ul>' dist_list = [] for dist in __import__('pkg_resources').working_set: dist_list.append(dist.project_name.replace('Python', '').strip()) dist_list = list(filter(None, dist_list)) for dist in dist_list: print "\n<li>", dist, '</li>' print '</ul>' print "</body></html>"
I saved the above code as a CGI script called “available_modules.py” and uploaded it to my website cgi-bin. Here is what the code produces, shown below in an iframe:
For more information about pkg_resources, see:
https://setuptools.readthedocs.io/en/latest/pkg_resources.html#package-discovery-and-resource-access-using-pkg-resources