Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions pygwalker/services/cloud_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,31 @@ def send(self, request: requests.PreparedRequest, **kwargs) -> requests.Response
kanaries_api_key = self.kanaries_api_key or GlobalVarManager.kanaries_api_key
if not kanaries_api_key:
logger.error((
"kanaries_api_key is not valid.\n"
"Please set kanaries_api_key first.\n"
"If you are not kanaries user, please register it from 'https://kanaries.net/home/access' \n"
"Then refer 'https://github.com/Kanaries/pygwalker/wiki/How-to-get-api-key-of-kanaries%3F' to set kanaries_api_key. \n"
"kanaries_api_key is not set or invalid.\n"
"To use Kanaries cloud features (e.g., AI Q&A, chart sharing), an API key is required.\n"
"\n"
"How to set up your API key:\n"
" 1. Sign up or log in at: https://kanaries.net\n"
" 2. Go to your API key manager at: https://kanaries.net/portal/apikey\n"
" 3. Copy your API key and set it using one of these methods:\n"
" a. In Python: pygwalker.walk(df, kanaries_api_key='your_api_key')\n"
" b. Via CLI: pygwalker config --set kanaries_token=your_api_key\n"
" c. Via environment variable: set KANARIES_API_KEY=your_api_key\n"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use a valid Unix env-var command in setup guidance

Method c tells users to run set KANARIES_API_KEY=your_api_key, but in bash/zsh this does not create/export KANARIES_API_KEY (it is treated as a positional argument), so Linux/macOS users who follow this path will still fail auth and keep getting TOKEN_ERROR. Since this message is explicitly setup guidance, it should use a working cross-shell instruction (for example export KANARIES_API_KEY=..., with platform-specific alternatives if needed).

Useful? React with 👍 / 👎.

"\n"
"For detailed instructions, see:\n"
" https://github.com/Kanaries/pygwalker/wiki/How-to-get-api-key-of-kanaries%3F\n"
" https://docs.kanaries.net/pygwalker\n"
))
raise CloudFunctionError("no kanaries api key. visit: https://docs.kanaries.net/ for setup documentation.", code=ErrorCode.TOKEN_ERROR)
raise CloudFunctionError(
"Kanaries API key is not set. "
"To use cloud features, please set your API key. "
"Get your key at: https://kanaries.net/portal/apikey -- "
"then set it via: pygwalker.walk(df, kanaries_api_key='your_key'), "
"or CLI: pygwalker config --set kanaries_token=your_key, "
"or env var: KANARIES_API_KEY. "
"Full guide: https://github.com/Kanaries/pygwalker/wiki/How-to-get-api-key-of-kanaries%3F",
code=ErrorCode.TOKEN_ERROR
)
resp = super().send(request, **kwargs)
try:
resp_json = resp.json()
Expand Down
4 changes: 2 additions & 2 deletions pygwalker/services/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def __str__(self) -> str:
["your kanaries token"],
default="empty string",
description="""
your kanaries token, you can get it from https://kanaries.net.
refer: https://space.kanaries.net/t/how-to-get-api-key-of-kanaries.
your kanaries token, you can get it from https://kanaries.net/portal/apikey.
refer: https://github.com/Kanaries/pygwalker/wiki/How-to-get-api-key-of-kanaries%3F
by kanaries token, you can use kanaries service in pygwalker, such as share chart, share config.
"""
)
Expand Down
2 changes: 1 addition & 1 deletion pygwalker/services/kaggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def show_tips_user_kaggle() -> bool:
has_set_api_key = False

tips = """
<p>Since you haven't set the kannaries_api_key, Pygwalker assumes it's your first time using it on Kaggle.</p>
<p>Since you haven't set the kanaries_api_key, Pygwalker assumes it's your first time using it on Kaggle.</p>
<p>Due to the persistent file approach in Kaggle, there may be some impact on the user experience when using Pygwalker on Kaggle.</p>
<p>Please take a moment to read this article: <a href="https://github.com/Kanaries/pygwalker/wiki/Best-Practices-for-Using-Pygwalker-in-Kaggle">Best Practices for Using Pygwalker in Kaggle</a>, which can help you optimize your Pygwalker experience on Kaggle.</p>
"""
Expand Down