自社開発環境はproxyサーバを介してネットワーク接続しているため、
ことあるごとにネットワークエラーになる。
例えばpipを実行時に単純に実行すると以下のようにRetryingが繰り返されます。
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
そこで実行時に
--proxy=<プロキシサーバ名>:
をつけて実行してみます。
ここでは以下の設定で実施しています。
プロキシサーバ名:proxy.hoge.co.jp
proxyポート: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)
無事ダウンロードが始まりました。
pythonを実行する際には、以下のように、
http_proxyとhttps_proxyを設定したあとにpythoを実行すればうまくいきました。
set http_proxy=http://proxy.hoge.co.jp:8080
set https_proxy=https://proxy.hoge.co.jp:8080
hoge.bat
rem proxy設定
set http_proxy=http://proxy.hoge.co.jp:8080
set https_proxy=https://proxy.hoge.co.jp:8080
python "fugafuga.py"