green-spider/checks/config.py
Marian Steinbach c065da4957
More unittests for checks (#73)
* Add test for dns_resolution
* Add test for domain_variations
* Add test for duplicate_content
2018-10-03 22:43:22 +02:00

30 lines
691 B
Python

class Config(object):
"""
Our configuration to be passed to checks
"""
def __init__(self, urls, user_agent='green-spider/1.0'):
self._urls = set(urls)
self._user_agent = user_agent
def __repr__(self):
return "Config(urls=%r)" % self._urls
@property
def urls(self):
return sorted(list(self._urls))
def add_url(self, url):
self._urls.add(url)
def remove_url(self, url):
"""Removes url from urls, if it was in there. Ignores errors."""
try:
self._urls.remove(url)
except KeyError:
pass
@property
def user_agent(self):
return self._user_agent