My company is trying to connect to an external network via an authentication proxy. I started using python on a Windows 10 machine for the first time in a few months, and when I tried to run pip from the command prompt, I was addicted to the authentication proxy settings, so I will leave it as a personal note.
This is an example command that appears on various sites.
set HTTP_PROXY=http://<UserName>:<Password>@<HostName>:<PortNo>
set HTTPS_PROXY=http://<UserName>:<Password>@<HostName>:<PortNo>
I use this command every time I touch python, so I thought I could afford it, and when I piped it, I got a 407 error ... I tried enclosing it in parentheses, removing the "http: //" part, and checking the proxy server address typo many times, but there is no sign that it will be cured at all ...
It's not good to use it after a long time.
By the way, I remembered that I messed up when I used python a few months ago ... but I can't remember what I actually messed with. I tried to take notes every time, but I didn't take them because of my lazy habit, so I took damage this time. After all, when I set a breakpoint on pip and went back to the proxy related area, I discovered that the proxy password was old (my company needs to change it once every three months). When I traced the code further, the proxy information was written directly in the source code of client.py of requests (I wrote it as if someone did it, but I did it myself)! Perhaps the last time I was playing around with it, it was a hassle to enter the proxy information over and over again. I don't remember. I shouldn't do this in the first place, but I thought I should take notes, so I wrote it in Qiita for the first time as a lesson.
Recommended Posts