diff --git a/dandelion/base.py b/dandelion/base.py index 79ef763..1445109 100644 --- a/dandelion/base.py +++ b/dandelion/base.py @@ -14,7 +14,7 @@ class DandelionConfig(dict): """ class for storing the default dandelion configuration, such as authentication parameters """ - ALLOWED_KEYS = ['app_id', 'app_key'] + ALLOWED_KEYS = ['token'] def __setitem__(self, key, value): if not key in self.ALLOWED_KEYS: @@ -55,20 +55,17 @@ def __init__(self, **kwargs): import requests from dandelion import default_config self.uri = self._get_uri(host=kwargs.get('host')) - self.app_id = kwargs.get('app_id', default_config.get('app_id')) - self.app_key = kwargs.get('app_key', default_config.get('app_key')) + self.token = kwargs.get('token', default_config.get('token')) + self.requests = requests.session() self.cache = kwargs.get('cache', NoCache()) - if self.REQUIRE_AUTH and not self.app_id: - raise MissingParameterException("app_id") - if self.REQUIRE_AUTH and not self.app_key: - raise MissingParameterException("app_key") + if self.REQUIRE_AUTH and not self.token: + raise MissingParameterException("token") def do_request(self, params, extra_url='', method='post', **kwargs): if self.REQUIRE_AUTH: - params['$app_id'] = self.app_id - params['$app_key'] = self.app_key + params['token'] = self.token url = self.uri + ''.join('/' + x for x in extra_url)