I can't upload to pypi using twine when a proxy server is involved.
That's what I tried so far:
python -m twine upload -u USER -p PASSWORD dist/*
When I'm behind our company proxy server twine just hangs, no error message.
Set the https_proxy and thehttp_proxy environment variables doesn't help as well.
Our company proxy server has it's own CA certificate (I've the .cer file).
So how can I use twine behind a proxy server.
With pip I was able to do it by adding the following pip.ini file to %Appdata%\pip:
[global]
proxy = proxy.company.com:8080
cert = C:\CA_Proxy.cer
I've been able to solve a similar issue under Windows by setting an HTTPS_PROXY environment variable, without having to set anything about certificates.
Working in a cmd prompt, run
set HTTPS_PROXY=proxy.company.com:8080
before running your twine command in the same session.
The environment variable can also be set permanently using the control panel or as described in https://superuser.com/q/79612/1148425
Setting the HTTPS_PROXY and TWINE_CERT environment variables in command prompt before running twine solve the problem:
set HTTPS_PROXY=proxy.company.com:8080
set TWINE_CERT=C:\CA_Proxy.pem
python -m twine upload -u USER -p PASSWORD dist/*
Remark: make sure that the certificate is in the PEM (Base-64 encoded X.509) format.
See the twine user manual for the TWINE_CERT environment variable
https://twine.readthedocs.io/en/latest/.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With