mirror of
https://github.com/netzbegruenung/green-spider.git
synced 2024-04-26 06:20:06 +02:00
ae6a2e83e9
See PR description for details
30 lines
683 B
Python
30 lines
683 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 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
|