scrapinghub / spidermon

Scrapy Extension for monitoring spiders execution.
https://spidermon.readthedocs.io
BSD 3-Clause "New" or "Revised" License
528 stars 96 forks source link

Are the `is_url` and `is_email` functions correct? #317

Open cuducos opened 2 years ago

cuducos commented 2 years ago

The is_url and is_email in spidermon/contrib/validation/jsonschema/formats.py returns True is the input is anything but a string.

Thus, dict(), 42, [42, {}, ('a', 'tuple')] would all be valid emails or URLs according to these logic.

Shouldn't these files read like this instead?

    if not isinstance(instance, str_types):
        return False
    # …