minor fix
This commit is contained in:
parent
37404591ce
commit
58c042fa3d
|
@ -5,6 +5,7 @@ import os
|
||||||
import gettext
|
import gettext
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
import ssl
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PySide6.QtWidgets import (QMainWindow, QDialog)
|
from PySide6.QtWidgets import (QMainWindow, QDialog)
|
||||||
|
@ -25,6 +26,7 @@ from app.commons.config import Params
|
||||||
# from ..version import __version__
|
# from ..version import __version__
|
||||||
from app.commons.ui_login import Ui_Login
|
from app.commons.ui_login import Ui_Login
|
||||||
# from app.css.flat_button_small import *
|
# from app.css.flat_button_small import *
|
||||||
|
context = ssl._create_unverified_context()
|
||||||
|
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
|
@ -247,7 +249,7 @@ def xconnection(mode, user, password, host, database, port):
|
||||||
if mode == 'http':
|
if mode == 'http':
|
||||||
conn = HTTPConnection(host, port=port, timeout=10)
|
conn = HTTPConnection(host, port=port, timeout=10)
|
||||||
else:
|
else:
|
||||||
conn = HTTPSConnection(host, port=port, timeout=10)
|
conn = HTTPSConnection(host, port=port, timeout=10, context=context)
|
||||||
url = '/' + database + '/login'
|
url = '/' + database + '/login'
|
||||||
payload = {
|
payload = {
|
||||||
'method': "common.db.login",
|
'method': "common.db.login",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import ssl
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from http.client import HTTPConnection, HTTPSConnection
|
from http.client import HTTPConnection, HTTPSConnection
|
||||||
|
@ -16,6 +17,7 @@ try:
|
||||||
from app.commons.common import slugify, file_open
|
from app.commons.common import slugify, file_open
|
||||||
except:
|
except:
|
||||||
from commons.common import slugify, file_open
|
from commons.common import slugify, file_open
|
||||||
|
context = ssl._create_unverified_context()
|
||||||
|
|
||||||
|
|
||||||
HEADERS = {
|
HEADERS = {
|
||||||
|
@ -162,7 +164,7 @@ class Model(object):
|
||||||
payload = json.dumps(data, default=encoder)
|
payload = json.dumps(data, default=encoder)
|
||||||
else:
|
else:
|
||||||
payload = None
|
payload = None
|
||||||
conn = self.conn(self.host, port=self.port)
|
conn = self.conn(self.host, port=self.port, context=self.context_http)
|
||||||
conn.request(method, url, body=payload, headers=HEADERS)
|
conn.request(method, url, body=payload, headers=HEADERS)
|
||||||
response = conn.getresponse()
|
response = conn.getresponse()
|
||||||
res = json.loads(response.read())
|
res = json.loads(response.read())
|
||||||
|
@ -212,8 +214,10 @@ class Report(object):
|
||||||
self.db = ctx['params']['database']
|
self.db = ctx['params']['database']
|
||||||
if ctx['params']['mode'] == 'http':
|
if ctx['params']['mode'] == 'http':
|
||||||
self.conn = HTTPConnection
|
self.conn = HTTPConnection
|
||||||
|
self.context_http = None
|
||||||
else:
|
else:
|
||||||
self.conn = HTTPSConnection
|
self.conn = HTTPSConnection
|
||||||
|
self.context_http = context
|
||||||
|
|
||||||
def get_connection(self, method, target, data=None):
|
def get_connection(self, method, target, data=None):
|
||||||
url = '/' + self.db + target
|
url = '/' + self.db + target
|
||||||
|
|
Loading…
Reference in New Issue