A python module for using Luogu Api.
Project description
A python module for using Luogu Api. 一个用于洛谷API的的Python模块。
Github: https://github.com/hlwdy/pyluog
如何使用
首先,你需要使用`pip install pyluog`来安装本模块,然后再进行引用:
`python import pyluog `
User类型属性:
name 当前账号的用户名
password 当前账号的密码,如果通过非账号密码登录方式登录,则该属性值为’*’
sess 当前账号的session会话对象 (requests的Session类)
uid 当前账号的uid
你可以定义一个User类型的账号变量,需要两个字符串参数,分别是账号密码:
`python a=pyluog.User('name','password') `
注意,以上操作并没有进行登录,登录操作需要执行:
`python a.login() `
中途会要求输入验证码,请根据显示的图片验证码正确输入。
如果过程顺利,最后会输出 登录成功!。
除此之外,你还可以使用cookie进行登录 (两个参数,__client_id和你的uid):
`python a=pyluog.loginWithCookie('aaabbcc1233dd344ee','12345') `
这将返回一个登录过的User对象给变量a (cookie需要校验)。
登录操作完成后,你可以用:
a.getUserData() 获取当前用户的信息
a.getRecordList(‘name’,’1’) 获取指定用户的评测提交记录 (两个参数分别是用户名和页数)
- a.getNotification(1,1) 获取当前用户的通知,(两个参数分别是类型和页数)
类型1: @我的
类型2: 回复
类型3: 系统通知
a.QianDao() 执行签到
a.getLatestMessages() 获取私信最新消息列表
a.getMessagesRecord(‘uid’) 获取与指定用户的聊天记录 (注意参数是uid而不是用户名)
a.sendMessage(‘uid’,’content’) 向指定用户发送一条私信
a.getLastCode(‘P1001’) 获取你指定题目最后一次提交的代码
a.getMyPastes() 获取你发布的所有云剪贴板信息
以上操作均会返回一个json对象。
无需登录账号即可执行的操作:
pyluog.getUid(‘name’) 根据用户名获取该用户的uid,如果不存在则返回’-1’
- pyluog.searchProblem(‘keyword’,1,-1) 搜索题库内容 (三个参数分别是关键词,页数和题目难度,默认难度-1)
-1为全部难度
0为暂无评定
1为入门
2为普及-
3为普及/提高-
4为普及+/提高
5为提高+/省选-
6为省选/NOI-
7为NOI/NOI+/CTSC
pyluog.getContestList(‘1’) 获取比赛列表,参数为页数
pyluog.getProblemInfo(‘P1001’) 获取指定题目的详细内容 (包括题面,提交数,通过数,难度等)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyluog-0.13.9.tar.gz.
File metadata
- Download URL: pyluog-0.13.9.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc03cdf3c4c8023281ba23fc654f6ddfe4664ffc683d9d2749b7d96356e9d92e
|
|
| MD5 |
0f4f5781e7931128388abc894048644b
|
|
| BLAKE2b-256 |
9a9a4fa46b1034ed1c45b465f805f51f45f904bff808ac16a5e37ae33632befa
|
File details
Details for the file pyluog-0.13.9-py3-none-any.whl.
File metadata
- Download URL: pyluog-0.13.9-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d85249a636f30bbfd09068c892dcbb0480d29b7518a82399c5d305ea1e8076b
|
|
| MD5 |
c5d5462627acceac3fca1848aa75ddab
|
|
| BLAKE2b-256 |
73d62c2ec472e3897291ed0cb8fa3c2c324e1c5cf9b6e7ecd3bb4a8d20c53ee7
|