Our API ansa
pip install -r requirements.txt
from ansa import Ansa
ansa = Ansa()
ansa.get_categories_list()
>>> ['homepage', 'cronaca', 'politica', 'mondo', 'economia', 'calcio', 'sport', 'cinema', 'cultura', 'tecnologia', 'ultimaora', 'englishnews', 'foto', 'video', 'abruzzo', 'basilicata', 'calabria', 'campania', 'emilia-Romagna', 'friuli-venezia-giulia', 'lazio', 'liguria', 'lombardia', 'marche', 'molise', 'piemonte', 'puglia', 'sardegna', 'sicilia', 'toscana', 'trentino-alto-adige', 'umbria', 'valle-aosta', 'veneto']
ansa.get_articles_by_category('homepage')
>>> [article_list]
ansa.get_article_by_title('mytitle', 'homepage')
>>> [article]
ansa.read_article('article_url')
>>> { "title" : "value",
"text" : "value",
"image" : "value", # <- retrieved by ansa site
... other article fields...
}
ansa.get_article('myfield', 'myvalue', 'mycategory')
>>> [article]
With this method, you can filter articles by any field
pip install -r requirements-dev.txt
pytest -s --cov