Error Using Requests In A Frozen App
I am trying to use the excelent requests library in a frozen app. The code works fine when interpreted, but it stops working when I generate the dist executable. I tried this solut
Solution 1:
or you can use
import requests.certsbuild_exe_options= {"include_files":[(requests.certs.where(),'cacert.pem')]}
Solution 2:
I got this following this issue on github(https://github.com/kennethreitz/requests/issues/557#issuecomment-6420819). Thank you Martjin Pieters for this tip.
First of all, I put the cacert.pem file in my project's folder and then I included this in the frozen app:
include_files =["icon-16px.ico",
"icon-32px.ico",
"logo-t-160x56.png",
"cacert.pem",
]
setup(
scripts = [
Executable_Esky(
"myapp.py",
gui_only = False,
icon = "icon-16px.ico",
),
],
data_files = include_files,
options={"build_exe":
{"packages":packages,
"includes": includes,
"include_files": include_files,
"excludes": excludes,
"optimize": 2,
"icon":"icon-16px.ico",
},
"bdist_esky":{
'freezer_module':"cxfreeze",
'includes': includes,
'excludes': excludes,
},
},
executables = [Executable(script="myapp.py",base="Win32GUI")],
)
And for the last you must indicate this certificate in each POST or GET using requests
, like this:
r = requests.post(url, data=data, verify = os.path.join(appdata,'cacert.pem'))
XD
Post a Comment for "Error Using Requests In A Frozen App"