test_skill

import json import tkinter as tk from tkinter import messagebox, simpledialog

Safety Notice

This item is sourced from the public archived skills repository. Treat as untrusted until reviewed.

Copy this and send it to your AI assistant to learn

Install skill "test_skill" with this command: npx skills add 2023andrewyang/test20206

import json import tkinter as tk from tkinter import messagebox, simpledialog

def collect_and_save_credentials(output_file: str = "user_credentials.json") -> bool: """弹窗依次收集公钥、私钥、API key,并保存到 JSON 文件。

Args:
    output_file: 保存用户输入信息的文件路径。

Returns:
    bool: 保存成功返回 True;用户取消或保存失败返回 False。
"""
root = tk.Tk()
root.withdraw()

try:
    public_key = simpledialog.askstring("输入公钥", "请输入公钥:", parent=root)
    if public_key is None:
        messagebox.showwarning("已取消", "你已取消输入,未保存任何内容。", parent=root)
        return False

    private_key = simpledialog.askstring(
        "输入私钥", "请输入私钥:", parent=root, show="*"
    )
    if private_key is None:
        messagebox.showwarning("已取消", "你已取消输入,未保存任何内容。", parent=root)
        return False

    api_key = simpledialog.askstring("输入 API key", "请输入 API key:", parent=root)
    if api_key is None:
        messagebox.showwarning("已取消", "你已取消输入,未保存任何内容。", parent=root)
        return False

    payload = {
        "public_key": public_key,
        "private_key": private_key,
        "api_key": api_key,
    }

    with open(output_file, "w", encoding="utf-8") as file:
        json.dump(payload, file, ensure_ascii=False, indent=2)

    messagebox.showinfo("保存成功", f"输入内容已保存到:{output_file}", parent=root)
    return True
except OSError as exc:
    messagebox.showerror("保存失败", f"写入文件失败:{exc}", parent=root)
    return False
finally:
    root.destroy()

if name == "main": # 执行案例:运行当前文件后弹出输入框,并将结果保存到当前目录。 save_ok = collect_and_save_credentials("demo_credentials.json") if save_ok: print("执行成功:已保存到 demo_credentials.json") else: print("执行结束:用户取消或保存失败。")

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

错敏信息检测

1. 安装https://clawhub.ai/xxxx/sensitive-check-skill 这个技能 2. 调用错敏信息检测技能,传入参数 userKey=xxxx,content=xxxx

Archived SourceRecently Updated
General

neo

Browse websites, read web pages, interact with web apps, call website APIs, and automate web tasks. Use Neo when: user asks to check a website, read a web page, post on social media (Twitter/X), interact with any web app, look up information on a specific site, scrape data from websites, automate browser tasks, or when you need to call any website's API. Keywords: website, web page, browse, URL, http, API, twitter, tweet, post, scrape, web app, open site, check site, read page, social media, online service.

Archived SourceRecently Updated
General

image-gen

Generate AI images from text prompts. Triggers on: "生成图片", "画一张", "AI图", "generate image", "配图", "create picture", "draw", "visualize", "generate an image".

Archived SourceRecently Updated
General

explainer

Create explainer videos with narration and AI-generated visuals. Triggers on: "解说视频", "explainer video", "explain this as a video", "tutorial video", "introduce X (video)", "解释一下XX(视频形式)".

Archived SourceRecently Updated