Skip to main content

Python utils for The Law Factory parsers

Project description

https://travis-ci.org/regardscitoyens/lawfactory_utils.svg?branch=master

A few utilities for the-law-factory-parser project, shared by senapy and anpy.

  • A simple caching library:

from lawfactory_utils.urls import enable_requests_cache, download
enable_requests_cache()

.....

resp = download(url)
print(resp.text)

The cached responses are stored in the directory where this lib is installed. You can use lawfactory_where_is_my_cache to print the path.

  • URL cleaning for senat/AN/legifrance/conseil-constit

>>> from lawfactory_utils.urls import clean_url
>>> clean_url('https://www.legifrance.gouv.fr/eli/loi/2017/9/15/JUSC1715752L/jo/texte')
'https://www.legifrance.gouv.fr/affichTexte.do?cidTexte=JORFTEXT000035567936&categorieLien=id'
  • Parsing of National Assembly URLS

>>> from lawfactory_utils.urls import parse_national_assembly
>>> parse_national_assembly_url("http://www.assemblee-nationale.fr/dyn/15/dossiers/retablissement_confiance_action_publique")
(15, 'retablissement_confiance_action_publique')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lawfactory_utils-0.1.3.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file lawfactory_utils-0.1.3.tar.gz.

File metadata

  • Download URL: lawfactory_utils-0.1.3.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for lawfactory_utils-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f80edf3e5544ec3b6b79ded971435126b3f217c8e275c4260a761496c4d5e0b4
MD5 a9f57224e87dd01b9414dfd9e00d2307
BLAKE2b-256 cd74b1f7085a236296724f59dbb194599f7e87fe3d827a409f334fa10fb2196d

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page