2020from .urls import (
2121 get_domain , get_scheme , prepare_url )
2222from .utils import (
23- memoize_articles , cache_disk , clear_memo_cache , encodeValue )
23+ memoize_articles , cache_disk , clear_memo_cache , encodeValue , extend_config )
2424
2525log = logging .getLogger (__name__ )
2626
@@ -52,16 +52,6 @@ class Source(object):
5252 articles = [<article obj>, <article obj>, ..]
5353 brand = 'cnn'
5454 """
55- def extend_config (self , config_items ):
56- """
57- We are handling config value setting like this for a cleaner api.
58- Users just need to pass in a named param to this source and we can
59- dynamically generate a config object for it.
60- """
61- for key , val in config_items .items ():
62- if hasattr (self .config , key ):
63- setattr (self .config , key , val )
64-
6555 def __init__ (self , url , config = None , ** kwargs ):
6656 """
6757 **The config object for this source will be passed into all of this
@@ -71,7 +61,7 @@ def __init__(self, url, config=None, **kwargs):
7161 raise Exception ('Input url is bad!' )
7262
7363 self .config = config or Configuration () # Order matters
74- self .extend_config (kwargs )
64+ self .config = extend_config (self . config , kwargs )
7565
7666 self .parser = self .config .get_parser ()
7767 self .extractor = StandardContentExtractor (config = self .config )
0 commit comments