Skip to content

italynews/pyansa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 + 🗞 = PyAnsa

GitHub license Open Source Love png3

Our API ansa

Install requirements

pip install -r requirements.txt

How to

Start

from ansa import Ansa

ansa = Ansa()

Retrieve all categories

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']

Article manipulation

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...
    }

Retrieve article by field

ansa.get_article('myfield', 'myvalue', 'mycategory')
>>> [article]

With this method, you can filter articles by any field

Develop on this

pip install -r requirements-dev.txt
pytest -s --cov

Releases

No releases published

Packages

No packages published

Languages