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

2024-04-29 15:17:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我第一次使用Python使用API,在这样做时,我遇到了以下错误:ValueError:cannotmixecountry/category参数和sources参数

我应该如何解决此错误

代码如下:

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')```

Tags: keyimportapiconfig参数top错误sources