Skip to main content

绿旗编程AI课程SDK

Project description

lqcode_sdk包使用说明

安装sdk

pip install lqcodeAI

导入包

from lqcodeAI import lq

基本使用

0. 访问密码

password = 'lqcode'  # 访问密码

1. 藏头诗生成功能

result = lq.ai_poetry(password, name)

参数说明:

  • password: 访问密码(字符串)
  • name: 藏头诗内容(字符串,默认为"李梅")

返回值说明:

{
    "poem": "生成的诗词内容",
    "explanation": "诗词解释"
}

示例:

# 生成"李梅"的藏头诗
result = lq.ai_poetry(password, "李梅")
print(result)
# 输出示例:
# {
#     "poem": "李白乘舟将欲行,\n梅子黄时雨。\n...",
#     "explanation": "这是一首描写春天景色的诗..."
# }

2. 天气查询功能

result = lq.ai_weather(password, city)

参数说明:

  • password: 访问密码(字符串)
  • city: 城市名称(字符串)

返回值说明:

{
    "weather_info": "天气信息",
    "explanation": "天气解释"
}

示例:

# 查询北京的天气
result = lq.ai_weather(password, "北京")
print(result)
# 输出示例:
# {
#     "weather_info": "晴,25℃,湿度45%,东南风3级",
#     "explanation": "今天北京天气晴朗,适合外出活动..."
# }

3. B站热榜功能

result = lq.ai_biliranking(password)

参数说明:

  • password: 访问密码(字符串)

返回值说明:

{
    "ranking": "B站热榜数据"
}

示例:

# 获取B站热榜
result = lq.ai_biliranking(password)
print(result)
# 输出示例:
# {
#     "ranking": "1. 【原神】新角色演示\n2. 【英雄联盟】S12总决赛\n3. 【美食】家常菜教程..."
# }

4. 成语接龙功能

result = lq.ai_idioms(password, idiom)

参数说明:

  • password: 访问密码(字符串)
  • idiom: 起始成语(字符串)

返回值说明:

{
    "idiom": "接龙的成语",
    "explanation": "成语解释"
}

示例:

# 从"一心一意"开始接龙
result = lq.ai_idioms(password, "一心一意")
print(result)
# 输出示例:
# {
#     "idiom": "意气风发",
#     "explanation": "形容精神振奋,气概豪迈..."
# }

错误处理

所有功能在遇到错误时会抛出 ValueError 异常,建议使用 try-except 进行错误处理:

try:
    result = lq.ai_poetry(password, "李梅")
    print(result)
except ValueError as e:
    print(f"发生错误: {e}")

注意事项

  1. 所有功能都需要提供有效的密码
  2. 输入参数必须是字符串类型
  3. 建议对返回结果进行错误检查
  4. 可以根据需要设置重试次数(部分功能支持)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lqcodeai-1.2.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lqcodeai-1.2.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file lqcodeai-1.2.1.tar.gz.

File metadata

  • Download URL: lqcodeai-1.2.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for lqcodeai-1.2.1.tar.gz
Algorithm Hash digest
SHA256 0946e2d05e6c7d2a786acff606ba9d3fb330c72e3b6c9363e4f50abab6535696
MD5 7bab9a8d6631c818d2564bff9e684855
BLAKE2b-256 d1e1c4739e928210f6799510eceee4b199d6c591179d98a9df56856ac6275ae4

See more details on using hashes here.

File details

Details for the file lqcodeai-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: lqcodeai-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for lqcodeai-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fec51f7e5388d4bd8f7786b608e300833f7a9fcdaa63febaf5cba9b581716f62
MD5 f4eac1a70d76e76b3d443caa45789229
BLAKE2b-256 4a82789209048010ce42f67037f57348d3c5e405151717bcfc819a749ae58c6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page