Package: anpy
ANpy: Scrape painlessly Assemblée Nationale websiteANpy is a python library for easily scraping data fromhttp://assemblee-nationale.frwebsiteForget the ugly html, just get data:>>> from anpy.dossier import Dossier
>>> url = 'http://www.assemblee-nationale.fr/14/dossiers/republique_numerique.asp'
>>> dossier = Dossier.download_and_build(url)
>>> dossier.title
'Economie : pour une République numérique'
>>> dossier.legislature
14
>>> r.procedure
'PPL'
>>> r.senat_url
'http://www.senat.fr/dossier-legislatif/pjl15-325.html'
>>> r.steps
[{'type': 'AN_PREMIERE_LECTURE', 'acts': [...]}]Supported FeaturesANpy currently provides the following features:Amendement parsingAmendement searchQuestion parsingQuestion searchDossier parsing (two differents formats)Scrutin parsingANpy supports Python 3.5.Install :pipinstallanpyDocumentationDocumentation is available athttp://anpy.readthedocs.io/en/latestCLIA script anpy-cli is installed with the package, it provides the following commands :Show an amendement given its urlanpy-clishow_amendementhttp://www.assemblee-nationale.fr/14/amendements/1847/CION-DVP/CD266.aspShow amendements summaries after a given dateanpy-clishow_amendements_summary--start-date2014-06-01Print amendements order for a given id_dossier and id_examenanpy-clishow_amendements_order33299--id-examen4073Show a questionanpy-clishow_questionhttp://questions.assemblee-nationale.fr/q14/14-73499QE.htmShow a law project (dossier législatif)Format is likesenapyand the Open Data oflafabriquedelaloi.frThere's more work done on this parser to make it work across many casesanpy-cliparsehttp://www.assemblee-nationale.fr/14/dossiers/sante.asp[{"assemblee_id":"14-sante","assemblee_legislature":14,"assemblee_slug":"sante","beginning":"2014-10-15","long_title":"Questions sociales et santé : modernisation de notre système de santé","steps":[{"date":"2014-10-15","institution":"assemblee","source_url":"http://www.assemblee-nationale.fr/14/projets/pl2302.asp","stage":"1ère lecture","step":"depot"},{"date":"2015-03-20","institution":"assemblee","source_url":"http://www.assemblee-nationale.fr/14/ta-commission/r2673-a0.asp","stage":"1ère lecture","step":"commission"},{"date":"2015-04-14","institution":"assemblee","source_url":"http://www.assemblee-nationale.fr/14/ta/ta0505.asp","stage":"1ère lecture","step":"hemicycle"},
...Features:Merging the law project across legislaturesParse from Open Data when available or fallback to scraping HTMLReturns an array of law projects since a page can contains many law projects (ex: organic + non-organic)You can also parse many of them by giving a list of urls:anpy-clidoslegs_urls|anpy-cliparse_manyan_doslegs/Show a law project (with a format is similar to the AN Open Data)This parser is still a work-in-progressanpy-clishow_dossierhttp://www.assemblee-nationale.fr/14/dossiers/sante.asp{"legislature":"14","procedure":"PJL","senat_url":"http://www.senat.fr/dossier-legislatif/pjl14-406.html","steps":[{"acts":[{"date":"2014-10-15T00:00:00","type":"DEPOT_INITIATIVE","url":"http://www.assemblee-nationale.fr/14/projets/pl2302.asp"},{"type":"ETUDE_IMPACT","url":"http://www.assemblee-nationale.fr/14/projets/pl2302-ei.asp"},{"date":"2015-03-16T00:00:00","type":"PROCEDURE_ACCELEREE"},{"date":"2015-03-20T00:00:00","type":"DEPOT_RAPPORT","url":"http://www.assemblee-nationale.fr/14/rapports/r2673.asp"},{"date":"2015-03-24T00:00:00","type":"TEXTE_COMMISSION","url":"http://www.assemblee-nationale.fr/14/ta-commission/r2673-a0.asp"},{"date":"2015-02-11T00:00:00","type":"DEPOT_RAPPORT","url":"http://www.assemblee-nationale.fr/14/rap-info/i2581.asp"},{...Find all the dossier urlsanpy-clidoslegs_urlsShow a scrutinanpy-clishow_scrutinhttp://www2.assemblee-nationale.fr/scrutins/detail/(legislature)/14/(num)/1212Running the testspipinstall-U-rtest_requirements.txt
pipinstall-e.
pycodestyle--exclude=tests,docs.
flake8--exclude=tests,docs.
py.test--cov=anpy