参考#
PyLuogu#
A model-based Python implement for Luogu API client
洛谷 API 客户端基于模型的 Python 实现
模型#
- class luogu.Paste(id: str)[源代码]#
剪贴板
- 参数
id (str) – 剪贴板 ID
- 变量
data (str) – 内容
id (str) – 剪贴板 ID
user (User) – 用户
time (datetime.datetime) – 时间
public (bool) – 是否公开
在 0.1 版更改: 变量 time 的类型自
int改为datetime.datetime
- class luogu.Problem(pid: str)[源代码]#
题目
- 参数
pid (str) – 题目 ID
- 引发
AccessDeniedHttpException – 您无权查看该题目
NotFoundHttpException – 题目未找到
- 变量
background (str) – 题目背景
description (str) – 题目描述
input_format (str) – 输入格式
output_format (str) – 输出格式
hint (str) – 说明/提示
provider (User) – 题目提供者
attachments (list[Attachment]) – 附件
can_edit (bool) – 可编辑
std_code (str) – 标准代码
wants_translation (bool) – 需要翻译
total_submit (int) – 总提交
total_accepted (int) – 总通过
flag (int) –
pid (str) – 题目 ID
title (str) – 题目标题
difficulty (int) – 难度
full_score (int) – 满分
type (str) – 题目类型
- class luogu.User(uid: int | str)[源代码]#
用户
- 参数
- 引发
NotFoundHttpException – 用户未找到
- 变量
register_time (datetime.datetime) – 注册时间
introduction (str) – 个人介绍
blog_address (str) – 个人博客地址
passed_problem_count (int | None) – 已通过题目数量
submitted_problem_count (int | None) – 提交题目数量
uid (int) – 用户 ID
name (str) – 用户名
slogan (str) – 个性签名
badge (str | None) – 徽章
is_admin (bool) – 是否管理员
is_banned (bool) – 是否被封禁
color (str) – 颜色
ccf_level (int) – CCF 等级
following_count (int) – 关注数量
follower_count (int) – 粉丝数量
ranking (int) – 排名
background (str) – 封面
is_root (bool | None) – 是否为 root
在 0.1 版更改: 变量 register_time 的类型自
int改为datetime.datetime
会话#
- class luogu.Session(cookies: str | dict[str, str] | None = None)[源代码]#
会话
- 参数
- 变量
cookies (requests.cookies.RequestsCookieJar) – Cookies
session (requests.Session) – 会话
- captcha(show: bool = True) bytes[源代码]#
获取验证码
- 参数
show (bool) – 值为真时使用
PIL.Image.Image.show()显示验证码;否则仅返回图片的二进制数据- 返回类型
异常#
- exception luogu.NotFoundHttpException[源代码]#
404
{ "code": 404, "currentTemplate": "InternalError", "currentData": { "errorType": "LuoguFramework\\HttpFoundation\\Controller\\Exception\\HttpException\\NotFoundHttpException", "errorMessage": "该页面未找到", "errorTrace": "" }, "currentTitle": "出错了", "currentTheme": null }