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