webmaster-kazu.com

テクノロジー・データ分析・実践ログ・その他

最小限の低レベル HTTP クライアント「httpcore」のインストール

カテゴリ: Python【初歩から現場実務的なもの】

最小限の低レベル HTTP クライアント「httpcore」のインストールについて解説しています。

「httpcore(https://github.com/encode/httpcore)」は、最小限の低レベルのHTTP クライアントで、「HTTPリクエストを送信する」というシンプルなものです。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)

■httpcoreをインストールする

httpcoreをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install httpcore

起動後、上記のコマンドを入力し、Enterキーを押します。

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、バージョンの切り替えを行います。

py -3.8 -m pip install httpcore

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable

Collecting httpcore

Using cached httpcore-0.15.0-py3-none-any.whl (68 kB)

Collecting h11<0.13,>=0.11

Using cached h11-0.12.0-py3-none-any.whl (54 kB)

Requirement already satisfied: anyio==3.* in c:\users\user_\appdata\roaming\python\python38\site-packages (from httpcore) (3.6.1)

Requirement already satisfied: sniffio==1.* in c:\users\user_\appdata\roaming\python\python38\site-packages (from httpcore) (1.3.0)

Requirement already satisfied: certifi in c:\users\user_\appdata\roaming\python\python38\site-packages (from httpcore) (2022.6.15)

Requirement already satisfied: idna>=2.8 in c:\users\user_\appdata\roaming\python\python38\site-packages (from anyio==3.*->httpcore) (3.3)

Installing collected packages: h11, httpcore

Attempting uninstall: h11

Found existing installation: h11 0.13.0

Uninstalling h11-0.13.0:

Successfully uninstalled h11-0.13.0

Successfully installed h11-0.12.0 httpcore-0.15.0

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、httpcoreが正常にインストールされたことになります。

なお、今回はhttpcoreのバージョン0.15.0をインストールしました。