diff --git a/sources.cfg.sample b/sources.cfg.sample new file mode 100644 index 0000000..a94053c --- /dev/null +++ b/sources.cfg.sample @@ -0,0 +1,19 @@ +[DEFAULT] +reliability = Unknown + +#For each source listed in FourmiCrawler/sources there should be a section +#named exactly as the filename in here. If not present, the DEFAULT value is +#used for reliability of that source. + +[ChemSpider] +reliability = High +#token=Paste ChemSpider API token here and remove the hashtag + +[NIST] +reliability = High + +[WikipediaParser] +reliability = Medium + +[PubChem] +reliability = High diff --git a/utils/configurator.py b/utils/configurator.py index 62987c6..b443529 100644 --- a/utils/configurator.py +++ b/utils/configurator.py @@ -1,7 +1,7 @@ import ConfigParser from scrapy.utils.project import get_project_settings - +import os class Configurator: """ @@ -66,8 +66,11 @@ class Configurator: variables for sources :return a ConfigParser object of sources.cfg """ + current_dir = os.path.dirname(os.path.abspath(__file__)) + config_path = current_dir + '\..\sources.cfg' + # [TODO]: location of sources.cfg should be softcoded eventually config = ConfigParser.ConfigParser() - config.read('sources.cfg') # [TODO]: should be softcoded eventually + config.read(config_path) return config @staticmethod