Archived
1
0

Merge branch 'feature/sourcescfg_fixes' into develop

This commit is contained in:
Jip J. Dekker 2014-06-17 23:53:10 +02:00
commit 484d10360c
2 changed files with 24 additions and 2 deletions

19
sources.cfg.sample Normal file
View File

@ -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

View File

@ -1,7 +1,7 @@
import ConfigParser import ConfigParser
from scrapy.utils.project import get_project_settings from scrapy.utils.project import get_project_settings
import os
class Configurator: class Configurator:
""" """
@ -66,8 +66,11 @@ class Configurator:
variables for sources variables for sources
:return a ConfigParser object of sources.cfg :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 = ConfigParser.ConfigParser()
config.read('sources.cfg') # [TODO]: should be softcoded eventually config.read(config_path)
return config return config
@staticmethod @staticmethod