ValueError:无法将国家/类别参数与来源参数混合

问题描述 投票:0回答:1

我第一次使用 Python 使用 API,在这样做时出现以下错误:ValueError:无法将国家/类别参数与源参数混合

我应该怎么做才能解决这个错误?

这是代码:

import config
from newsapi import NewsApiClient

newsapi = NewsApiClient(api_key=config.api_key)

top_headlines = newsapi.get_top_headlines(q='Neuralink',sources='the-verge',category='technology',language='en',country='us')```
python python-3.x api python-module valueerror
1个回答
0
投票

根据官方“NewsAPI”{https://newsapi.org/docs/endpoints/top-headlines} top-headlines 文档, “国家”和“类别”不能与“来源”参数同时使用。

© www.soinside.com 2019 - 2024. All rights reserved.