It is blocked by Proxy, a connection error occurs in Python or pip, and it is retried.

Since the in-house developed environment is connected to the network via a proxy server, Every time I get a network error.

For example, if you simply execute pip at runtime, Retrying will be repeated as follows.

C:\Users\thithi7110>pip install webdriver_manager
Collecting webdriver_manager
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/webdriver-manager/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/webdriver-manager/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/webdriver-manager/
Operation cancelled by user

So at runtime

--proxy = : I will try to execute it with. Here, the settings are as follows. Proxy server name: proxy.hoge.co.jp proxy port: 8080

C:\Users\thithi7110>pip install webdriver_manager --proxy=proxy.hoge.co.jp:8080
Collecting webdriver_manager
  Downloading https://files.pythonhosted.org/packages/dd/3c/2e2d71aeb28ee73ecaf12b545542b082ca81c8c091bb05028c52c42696ce/webdriver_manager-2.4.0-py2.py3-none-any.whl
Collecting crayons (from webdriver_manager)
  Downloading https://files.pythonhosted.org/packages/5b/0d/e3fad4ca1de8e70e06444e7d777a5984261e1db98758b5be3e8296c03fe9/crayons-0.4.0-py2.py3-none-any.whl
Collecting requests (from webdriver_manager)

The download has started successfully.

When running python, like this: I ran pytho after setting http_proxy and https_proxy and it worked.

set http_proxy=http://proxy.hoge.co.jp:8080 set https_proxy=https://proxy.hoge.co.jp:8080

hoge.bat


rem proxy settings
set http_proxy=http://proxy.hoge.co.jp:8080
set https_proxy=https://proxy.hoge.co.jp:8080
python "fugafuga.py"

Recommended Posts

It is blocked by Proxy, a connection error occurs in Python or pip, and it is retried.
How to input a character string in Python and output it as it is or in the opposite direction.
Set a proxy for Python pip (described in pip.ini)
I wrote python3.4 in .envrc with direnv and allowed it, but I got a syntax error
Note installing modules such as pytorch and opencv with pip in Blender python (2.82a or later)
Proxy settings for python pip in a corporate environment don't work (for example, Python 3.7.5 is OK, but 3.7.6 is NG)
Delete a particular character in Python if it is the last
Explain what is stochastic gradient descent by running it in Python
Difference between == and is in python
[Python] return A [or / and] B
[Python] Sweet Is it sweet? About suites and expressions in the official documentation
Is the space replaced by a plus sign or% 20 in percent-encoding processing?
Connect a lot of Python or and and
Hash in Perl is a dictionary in Python
How to use is and == in Python
[Python] What to do if an error occurs in pip (pyinstaller, pyautogui, etc.)
[Python] Precautions when retrieving data by scraping and putting it in the list
Output timing is incorrect when standard (error) output is converted to a file in Python
What to do if a Unicode Encode Error occurs in Sublime Text Python
A complete guidebook to using pyenv, pip and python in an offline environment
If you try to install Python2 pip after installing Python3 pip and it is rejected
Why Python slicing is represented by a colon (:)
Error when installing a module with Python pip
Organize python modules and packages in a mess
What is "functional programming" and "object-oriented" in Python?
"Import Error: Install xlrd> = 0.9.0 for Excel support" error in Pandas. Resolved by changing to use openpyxl
Install python on xserver to use pip
Install tweepy with pip and use it for API 1.1
I wrote a class in Python3 and Java
About the difference between "==" and "is" in python
Notify error and execution completion by LINE [Python]
Let's write a Python program and run it
POST JSON in Python and receive it in PHP
Use a custom error page in python / tornado
Judge whether it is a prime number [Python]
A Python script that crawls RSS in Azure Status and posts it to Hipchat
Draw a weakness graph in Python and save it in various formats (Raspberry Pi, macOS)
[Python] Rename all image files in a specific folder by shooting date and time
The result of making a map album of Italy honeymoon in Python and sharing it
It would be wise to write like boolean and "A" or "B" [Python] [But]
How to use any or all to check if it is in a dictionary (Hash)
[Selenium] Open the link in a new tab and move it [Python / Chrome Driver]
It is easy to execute SQL with Python and output the result in Excel