Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set token in inline config #83

Merged
merged 4 commits into from
Nov 20, 2017
Merged

Set token in inline config #83

merged 4 commits into from
Nov 20, 2017

Conversation

gbolly
Copy link
Contributor

@gbolly gbolly commented Nov 15, 2017

No description provided.

@@ -51,12 +51,13 @@ class DataDotWorld(object):
REST API client object
"""

def __init__(self, config=None):
def __init__(self, config=None, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to accept auth_token via kwargs. If a client wanted to pass the token inline, they could just construct an inline config and pass it in the existing config param here (i.e. dw = DataDotWorld(config=InlineConfig(token)))

@@ -114,7 +115,8 @@ def query(self, dataset_key, query, query_type="sql", parameters=None):
raise RuntimeError(
'Error executing query: {}'.format(response.content))

def load_dataset(self, dataset_key, force_update=False, auto_update=False):
def load_dataset(self, dataset_key, force_update=False, auto_update=False,
**kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kwargs doesn't seem to be used here.

config_param = (ChainedConfig()
if profile == 'default'
else FileConfig(profile=profile))
token = kwargs.get('auth_token')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section could be simplified as:

config_param = (ChainedConfig(config_chain=[
    InlineConfig(kwargs.get('auth_token')), 
    EnvConfig(), 
    FileConfig()])
        if profile == 'default'
        else FileConfig(profile=profile))

@rflprr rflprr merged commit d5d5268 into master Nov 20, 2017
@rflprr rflprr deleted the issue/set-token-python branch November 22, 2017 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants