[PYTHON] A story that struggled with the common set HTTP_PROXY = ~

Introduction

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.

Example command

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.

The cause is lazy

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

A story that struggled with the common set HTTP_PROXY = ~
The story that the private key is set to 600 with chmod
A story that struggled to handle the Python package of PocketSphinx
The story of making a module that skips mail with python
A story that visualizes the present of Qiita with Qiita API + Elasticsearch + Kibana
A model that identifies the guitar with fast.ai
The story that fits in with pip installation
The story of making a web application that records extensive reading with Django
A story that reduces the effort of operation / maintenance
A memo that I touched the Datastore with python
The story that Japanese output was confused with Django
A story that analyzed the delivery of Nico Nama.
A story about how to deal with the CORS problem
The story that Python stopped working with VS Code (Windows 10)
[Python] A program that finds the most common bird types
[Golang] A program that determines the turn with random numbers
The story of making a question box bot with discord.py
A story stuck with the installation of the machine learning library JAX
The story that a hash error came out when using Pipenv
The story of making a standard driver for db with python.
The story of creating a site that lists the release dates of books
The story that I set transparent proxy and it worked for some reason without a certificate
A story that didn't work when I tried to log in with the Python requests module
A story that supports electronic scoring of exams with image recognition
I made a program that automatically calculates the zodiac with tkinter
The story of writing a program
The story of creating a bot that displays active members in a specific channel of slack with python
The story of a Parking Sensor in 10 minutes with GrovePi + Starter Kit
The story of making a university 100 yen breakfast LINE bot with Python
The LXC Web Panel that can operate LXC with a browser was wonderful
The story of having a hard time introducing OpenCV with M1 MAC
Extract lines that match the conditions from a text file with python
The story of developing a web application that automatically generates catchphrases [MeCab]
The story of making a sound camera with Touch Designer and ReSpeaker
The story of making a package that speeds up the operation of Juman (Juman ++) & KNP
Set up a server that processes multiple connections at the same time
The story that Apache dealt with because it was down at AH00144
Tweet the weather forecast with a bot
[Python] A program that creates stairs with #
[Python] Set the graph range with matplotlib
A class that hits the DMM API
A story that stumbled upon installing matplotlib
The story that FastAPI may take supremacy
The story that scipy suddenly stopped loading
Draw a Mandelbrot set with Brainf * ck
Set the xticklabels color individually with matplotlib
A typed world that begins with Python
The story that XGBoost was finally installed
The story of blackjack A processing (python)
A code that corrects the yoon / sokuon (sokuon)
[Python] A program that rounds the score
A story that did not end with exit when turning while with pipe input
The story of IPv6 address that I want to keep at a minimum
An article that just tries a little HTTP request with the curl command
The story of making a box that interconnects Pepper's AL Memory and MQTT
Around the authentication of PyDrive2, a package that operates Google Drive with Python
The story of Django creating a library that might be a little more useful
The story of the learning method that acquired LinuC Level 1 with only ping -t
Calculate the optimal solution to set a world record for decathlon with scipy.optimize
The story of making a Line Bot that tells us the schedule of competitive programming
A story about making an x86 bootloader that can boot vmlinux with Rust