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

744 default api key #752

Merged
merged 9 commits into from
Jun 10, 2019
Merged

744 default api key #752

merged 9 commits into from
Jun 10, 2019

Conversation

Jesus89
Copy link
Member

@Jesus89 Jesus89 commented Jun 10, 2019

Fixes: #744

@Jesus89 Jesus89 requested a review from andy-esch June 10, 2019 11:18
Copy link
Contributor

@andy-esch andy-esch left a comment

Choose a reason for hiding this comment

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

Nice and concise :) I crave some more docs to help explain to the user what's going on, but looks great overall.

@@ -20,6 +20,14 @@ def set_default_context(context=None, base_url=None, api_key=None, creds=None, s
api_key='your api key'
)

From a base_url (for public datasets)
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea of educating the user about what's happening. How about saying something about how default_public is used for the API key in this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@@ -6,7 +6,7 @@
_default_context = None


def set_default_context(context=None, base_url=None, api_key=None, creds=None, session=None):
def set_default_context(context=None, base_url=None, api_key='default_public', creds=None, session=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm missing the Args section of the docs here. Is that going to happen package-wide in another PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I'll add it in this PR

@@ -6,7 +6,7 @@
_default_context = None


def set_default_context(context=None, base_url=None, api_key=None, creds=None, session=None):
def set_default_context(context=None, base_url=None, api_key='default_public', creds=None, session=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels a little strange to me that context can be used for a base_url or a cartoframes.Context object, but it also makes some logical sense that a base url is essentially a context if there's a default api key.

Some ideas to get around this:

  • force keyword args using the * notation in the function signature, and let the first arg be a more generic thing
  • rename the context kwarg?
  • do nothing because it's fine :) But clear docs explaining what's going on

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The first param can be a context or a base_url. Renaming it to be more generic is a good approach to me.

@Jesus89 Jesus89 merged commit 2e1a1aa into develop Jun 10, 2019
@Jesus89 Jesus89 deleted the 744-default-api-key branch June 10, 2019 14:14
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.

Use default_public as default api key
2 participants