kazuuu.net

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

世界中のニュースを収集できるNewsAPI用の非公式Pythonクライアント「newsapi-python」をインストール

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

世界中のニュースを収集できるNewsAPI用の非公式Pythonクライアント「newsapi-python」のインストールについて解説しています。

newsapi-pythonは、世界のニュースを検索できる「NewsAPI」の非公式Pythonクライアントです。

■Python

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

■newsapi-pythonのインストール

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

pip install newsapi-python

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

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

py -3.6 -m pip install newsapi-python

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

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

Collecting newsapi-python

Downloading newsapi_python-0.2.6-py2.py3-none-any.whl (7.9 kB)

Requirement already satisfied: requests<3.0.0 in c:\users\user_\appdata\roaming\python\python36\site-packages (from newsapi-python) (2.21.0)

Requirement already satisfied: certifi>=2017.4.17 in c:\users\user_\appdata\roaming\python\python36\site-packages (from requests<3.0.0->newsapi-python) (2020.12.5)

Requirement already satisfied: idna<2.9,>=2.5 in c:\users\user_\appdata\roaming\python\python36\site-packages (from requests<3.0.0->newsapi-python) (2.8)

Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\user_\appdata\roaming\python\python36\site-packages (from requests<3.0.0->newsapi-python) (1.24.3)

Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\user_\appdata\roaming\python\python36\site-packages (from requests<3.0.0->newsapi-python) (3.0.4)

Installing collected packages: newsapi-python

Successfully installed newsapi-python-0.2.6

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

なお、今回はnewsapi-pythonのバージョン0.2.6をインストールしました。