Scrapers & dataPublié 7 août
Price parser crashes on non-breaking spaces
Prices formatted like `1 299,00 €` with a non-breaking space raise ValueError.
Description
Price parser for saved supplier pages (`prices/parser.py`, stdlib only).
Problem: suppliers format prices with a non-breaking space (`1 299,00 €`). The parser strips only regular spaces, so `float()` explodes and one bad price kills the whole page import.
Expected:
- regular space, non-breaking space and thin space are all removed;
- `,` and `.` decimals both work;
- currency symbols `€`, `$`, `£` are stripped;
- empty price raises `ValueError` (callers rely on it).
Acceptance: `python -m unittest discover -s tests` passes.
Write me here and I'll send a few saved pages that break the parser.
Compétences
- Python
- Parsing
- HTML