Hello,
I have the following Python 2 script to connect to some HTTPS resource, pretty much taken from
https://docs.python.org/2.7/library/urllib2.html#examples using urllib2, because urllib doesn't seem to be able to handle HTTPS at all (see
https://docs.python.org/2.7/library/urllib.html#urllib-restrictions):
import sys
from urllib2 import Request, urlopen, HTTPError, URLError
from mforms import *
from wb import *
class Logger:
def __init__(self):
pass
def write(self, s):
"""Causes the standard prints to be seen in the standard WB log (./log/wb.log)."""
grt.log_info('print', s)
# install print logger
sys.stdout = Logger()
# define this Python module as a GRT module
ModuleInfo = DefineModule(name='JpaEntities', author='Mr X', version='1.0.Beta')
@ModuleInfo.plugin("wb.catalog.util.generate_jpa_annotated_classes",
caption="JPA Entities",
input=[wbinputs.currentCatalog()],
pluginMenu="Catalog")
@ModuleInfo.export(grt.INT, grt.classes.db_Catalog)
def generate_jpa_annotated_classes(catalog):
"""Entry method for the plugin."""
print("Executing generate_jpa_annotated_classes(catalog)... ")
url = "https://www.google.com" # this doesn't work
# url = "http://www.google.com" # this works
try:
req = Request(url)
script = urlopen(req).read()
except HTTPError as he:
script = "HTTPError: " + he.getcode()
except URLError as ue:
script = "URLError: " + ue.reason + ", " + ue.message
print("Loaded:\n\n" + script)
...
This gives me an error when executing the plugin (wb.log):
.
.
.
Installed video RAM: -2048 MB
Current video mode: 3840 x 1600 x 4294967296 Farben
Used bit depth: 32
Driver version: 26.21.14.4332
Installed display drivers: C:\WINDOWS\System32\DriverStore\FileRepository\nvlt.inf_amd64_7f06ea667a45eb6e\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvlt.inf_amd64_7f06ea667a45eb6e\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvlt.inf_amd64_7f06ea667a45eb6e\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvlt.inf_amd64_7f06ea667a45eb6e\nvldumdx.dll
Current user language: Deutsch (Deutschland)
10:11:19 [INF][ Workbench]: UI is up
10:11:20 [WRN][ grt]: C:\Users\Kawu\AppData\Roaming\MySQL\Workbench/bbstats.mwbd/document.mwb.xml:17230: link '{ED75E1F2-667B-4B8A-945E-8185BB0066EE}' <object > key= could not be resolved
10:11:20 [WRN][ grt]: C:\Users\Kawu\AppData\Roaming\MySQL\Workbench/bbstats.mwbd/document.mwb.xml: skipping element 'link' in unserialized document, line 17230Running the application
10:11:22 [INF][ Canvas backend]: Found OpenGL version for this view: 4.6.0 NVIDIA 443.32
10:11:23 [INF][ print]: Executing generate_jpa_annotated_classes(catalog)...
10:11:23 [INF][ print]: Loaded:
URLError: unknown url type: https,
What's wrong? No support for HTTPS? Really? Or what is it?
I actually MUST connect to my Github repo, but without HTTPS, this is not going to work nor is it clever. *shrug*
Is there any way to get it done, that is, without installing some additional modules etc.?
Thanks
Karsten
PS: the Logger class plus sys.stdout = Logger() is important to make the inbuilt print function actually write into wb.log!