Parser for Czech animal shelters.
Currently parsing animals from shelters:
- http://nadace-tlapka.cz/
- http://www.mpb.cz/
- http://www.zooliberec.cz/archa/cz/utulke
- http://www.azylpes.cz/
- http://www.klasterec.cz/cs_ob_priroda_utulek.php
- http://www.utulekpropsy.org/
This parser is used at NajdiMazla.cz.
$ pip install -r requirements.txt
$ ./setup.py install
#!/usr/bin/env python
from shelterparser.importers import AnimalImporter
# import all animals and don't throw any exceptions
importer = AnimalImporter()
# in case of problem at importing, animal is skipped
for animal in importer.iter_animals():
# do something with imported animal
pass
#!/usr/bin/env python
import datetime
from shelterparser.importers import AnimalImporter
# import animals from given date and throw exceptions
importer = AnimalImporter(from_date=datetime.date(2014, 3, 15), throw_exceptions=True)
# inicialize list of used animal shelters
shelters = AnimalImporter.get_shelters()
# generating animals one by one so we can catch exceptions
animal_generator = importer.iter_animals()
while True:
try:
animal = next(animal_generator)
shelter = shelters[animal['shelter_id']]
# do something with imported animal
except StopIteration:
break
except:
# process exception of currently imported animal
pass
© 2014 Vojtěch Oram