News-API-gh/News-API-python

Python's API param issue

richielo opened this issue · 3 comments

Hi, I am playing with this API using the pageSize and page params to retrieve top headlines on Hong Kong news with a developer account. It doesn't seem to be working. It always returns me 20 news article

Here's my Url: https://newsapi.org/v2/top-headlines?country=hk&pageSize=100&page=2&apiKey=[apiKey]

Am I doing anything wrong here?

Thank you very much for your help in advance

Were you able to solve this problem, please ? Because I'm having the same problem here.
Even if the results shows this 'totalResults': 6502, , I only get 20 articles.

@hadjer13 It's been like half a year since I posted this issue. If I remember correctly, I gave up on making this to work. Sorry about that, wish I have a better answer to this

I tried with:

import requests

url = 'http://newsapi.org/v2/top-headlines'

params = {}
params['country'] = 'hk'
params['pageSize'] = '100'
params['page'] = '2'
params['apiKey'] = 'API_KEY'

r = requests.get(url, params=params)
print(r.json())

got

{'status': 'error',
 'code': 'maximumResultsReached',
 'message': 'You have requested too many results. Developer accounts are limited to a max of 100 results. You are trying to request results 100 to 200. Please upgrade to a paid plan if you need more results.'}