並行ライブラリを用いた非同期HTTPリクエストができる「grequests」のインストール

スポンサーリンク

並行ライブラリを用いたGeventでRequestsを使用し、非同期HTTPリクエストを簡単に作成できる「grequests」のインストールについて解説しています。

「grequests(https://github.com/spyoungtech/grequests)」は、Pythonで書かれた非同期HTTPリクエストを簡単に作成できるライブラリです。

■Python

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

■grequestsをインストールする

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

pip install grequests

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

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、pipを使う場合にはコマンドでの切り替えを行います。

py -3.8 -m pip install grequests

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

Defaulting to user installation because normal site-packages is not writeable
Collecting grequests
Downloading grequests-0.6.0-py3-none-any.whl (5.2 kB)
Requirement already satisfied: requests in c:\users\user_\appdata\roaming\python\python38\site-packages (from grequests) (2.24.0)
Collecting gevent
Downloading gevent-21.12.0-cp38-cp38-win_amd64.whl (1.6 MB)
|████████████████████████████████| 1.6 MB 819 kB/s
Requirement already satisfied: cffi>=1.12.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from gevent->grequests) (1.14.5)
Requirement already satisfied: greenlet<2.0,>=1.1.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from gevent->grequests) (1.1.2)
Requirement already satisfied: setuptools in c:\users\user_\appdata\roaming\python\python38\site-packages (from gevent->grequests) (59.6.0)
Requirement already satisfied: zope.interface in c:\users\user_\appdata\roaming\python\python38\site-packages (from gevent->grequests) (5.4.0)
Collecting zope.event
Downloading zope.event-4.5.0-py2.py3-none-any.whl (6.8 kB)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests->grequests) (2021.5.30)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests->grequests) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests->grequests) (1.25.11)
Requirement already satisfied: idna<3,>=2.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests->grequests) (2.10)
Requirement already satisfied: pycparser in c:\users\user_\appdata\roaming\python\python38\site-packages (from cffi>=1.12.2->gevent->grequests) (2.20)
Installing collected packages: zope.event, gevent, grequests
Successfully installed gevent-21.12.0 grequests-0.6.0 zope.event-4.5.0

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

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

コメント

タイトルとURLをコピーしました