SuperAPI AI 工具集

data-query

数据与分析

查看项目

更新于 10-16 04:41

技能介绍

Data Query Skill 是一个数据查询类技能,用于查询各类数据信息,官方说明涵盖汇率、农历、历史事件、百科、油价、金价和化学元素。

一、用途 该技能面向需要获取多种实时或常识类数据的场景,通过 60s API 提供的 HTTP 接口返回结构化数据,可用于构建货币换算、日历、历史提醒、百科检索等应用。

二、主要能力与查询类型 根据资料,提供以下查询能力:

  1. 汇率(Exchange Rates):货币换算汇率。
  2. 农历(Lunar Calendar):中国农历转换。
  3. 历史上的今天(Today in History):历史事件。
  4. 百科(Baike):搜索中文百科。
  5. 油价(Fuel Prices):中国汽油/柴油价格。
  6. 金价(Gold Prices):当前黄金价格。
  7. 化学元素(Chemical Elements):元素信息。

三、API 端点 资料列出以下端点与方法:

  • 汇率 /v2/exchange-rate,GET
  • 农历 /v2/lunar,GET
  • 历史 /v2/today-in-history,GET
  • 百科 /v2/baike,GET
  • 油价 /v2/fuel-price,GET
  • 金价 /v2/gold-price,GET
  • 化学元素 /v2/chemical,GET

四、使用方式 通过 Python requests 调用接口,基础地址为 https://60s.viki.moe。示例代码保留如下:

汇率: import requests params = {'from': 'USD', 'to': 'CNY'} response = requests.get('https://60s.viki.moe/v2/exchange-rate', params=params) rate = response.json() print(f"💱 1 {rate['from']} = {rate['rate']} {rate['to']}") print(f"更新时间:{rate['update_time']}")

农历: response = requests.get('https://60s.viki.moe/v2/lunar') lunar = response.json() print(f"📅 公历:{lunar['solar_date']}") print(f"🏮 农历:{lunar['lunar_date']}") print(f"🐲 生肖:{lunar['zodiac']}") print(f"🌾 节气:{lunar['solar_term']}") 指定日期:params = {'date': '2024-01-15'},调用同一端点。

历史上的今天: response = requests.get('https://60s.viki.moe/v2/today-in-history') history = response.json() print(f"📜 历史上的今天 ({history['date']})") for event in history['events'][:5]: print(f"{event['year']}年:{event['title']}") 指定日期:params = {'month': 1, 'day': 15}

百科: params = {'keyword': 'Python编程'} response = requests.get('https://60s.viki.moe/v2/baike', params=params) result = response.json() print(f"📖 {result['title']}") print(f"📝 {result['summary']}") print(f"🔗 {result['url']}")

油价: params = {'province': '北京'} response = requests.get('https://60s.viki.moe/v2/fuel-price', params=params) prices = response.json() 打印 92号汽油、95号汽油、98号汽油、0号柴油 价格。

金价: response = requests.get('https://60s.viki.moe/v2/gold-price') gold = response.json() 打印国际金价、国内金价、更新时间。

化学元素: params = {'query': 'H'} # 可用符号、名称或原子序数 response = requests.get('https://60s.viki.moe/v2/chemical', params=params) element = response.json() 打印 name、symbol、atomic_number、atomic_mass、category。

五、适用场景 资料给出三类示例场景:

  1. 货币换算机器人:根据汇率将金额从一种货币换算为另一种货币。
  2. 历史事件提醒:获取当天历史事件并输出消息。
  3. 农历日历组件:输出公历、星期、农历、生肖、节气等信息。 文中还列举交互示例,例如查询美元兑人民币汇率、今天农历日期、氢元素信息。

六、限制 资料未说明该技能的收费、价格、使用限制、调用频率、数据授权与准确性保证等信息,暂未提供。