Add ca_bundle for ssl termination. Add config.ini file for parameters

This commit is contained in:
Ettore
2026-01-08 21:41:01 +01:00
parent afbd0a2643
commit c5ff6ce958
3 changed files with 27 additions and 12 deletions

2
.gitignore vendored
View File

@@ -28,4 +28,4 @@ __pycache__/*
!fatture_ccsr/fatture_ccsr.spec !fatture_ccsr/fatture_ccsr.spec
*.wxg *.wxg
.venv .venv
*/config.ini config.ini

View File

@@ -40,8 +40,8 @@ class FattureCCSRFrame(wx.Frame):
config_file = "./config.ini" config_file = "./config.ini"
try: try:
config = configparser.ConfigParser() self.config = configparser.ConfigParser()
config.read_file(open(config_file)) self.config.read_file(open(config_file))
except Exception as e: except Exception as e:
print(f"Error in reading the config file: {e}") print(f"Error in reading the config file: {e}")
sys.exit(2) sys.exit(2)
@@ -56,7 +56,9 @@ class FattureCCSRFrame(wx.Frame):
self.input_files = list() self.input_files = list()
self.log_dialog = None self.log_dialog = None
self.session = requests.Session() self.session = requests.Session()
self.session.verify = self.config['REPORT_SERVER'].get('CA_BUNDLE', True)
self.panel = wx.Panel(self, wx.ID_ANY, style=wx.BORDER_NONE | wx.FULL_REPAINT_ON_RESIZE | wx.TAB_TRAVERSAL) self.panel = wx.Panel(self, wx.ID_ANY, style=wx.BORDER_NONE | wx.FULL_REPAINT_ON_RESIZE | wx.TAB_TRAVERSAL)
self.main_sizer = wx.BoxSizer(wx.VERTICAL) self.main_sizer = wx.BoxSizer(wx.VERTICAL)
@@ -298,7 +300,7 @@ class LoginDialog(wx.Dialog):
session = self.GetParent().session session = self.GetParent().session
session.auth = requests_ntlm.HttpNtlmAuth("sanrossore\\"+self.username.GetValue(), self.password.GetValue()) session.auth = requests_ntlm.HttpNtlmAuth("sanrossore\\"+self.username.GetValue(), self.password.GetValue())
try: try:
login = session.get('https://report.casadicurasanrossore.it:8443/Reports/browse/') login = session.get(self.GetParent().config['REPORT_SERVER']['URL']+'/Reports/browse/')
if login.status_code == 200: if login.status_code == 200:
self.logged_in = True self.logged_in = True
self.username.SetValue('') self.username.SetValue('')

View File

@@ -1,8 +1,21 @@
requests_ntlm==1.1.0 # HTTP requests and NTLM authentication
wxPython==4.0.7 requests>=2.28.0
requests==2.24.0 requests-ntlm>=1.1.0
openpyxl==3.0.5
Unidecode==1.1.2 # GUI framework
PyPDF2==1.26.0 wxPython>=4.1.0
numpy<1.24
lxml # Excel file parsing
openpyxl>=3.7.0
# PDF manipulation
PyPDF2>=2.0.0
# String utilities
Unidecode>=1.2.0
# XML parsing and validation
lxml>=4.6.0
# Numerical operations
numpy>=1.20.0