1
1
# luogu-api-python
2
- A Python implementation of the Luogu API
2
+ A Python implementation of the Luogu API.
3
3
4
4
## Project Description
5
5
@@ -30,6 +30,8 @@ To install the package from source, follow these steps:
30
30
31
31
## Usage
32
32
33
+ ### Synchronous API
34
+
33
35
Here is an example of how to use the package:
34
36
35
37
```python
@@ -44,6 +46,28 @@ for problem in problems:
44
46
print(problem.title)
45
47
```
46
48
49
+ ### Asynchronous API (Experimental)
50
+
51
+ The package also provides experimental support for async operations:
52
+
53
+ ``` python
54
+ import asyncio
55
+ import pyLuogu
56
+
57
+ # Initialize the async API without cookies
58
+ luogu = pyLuogu.asyncLuoguAPI()
59
+
60
+ async def main ():
61
+ async with luogu:
62
+ problems = (await luogu.get_problem_list()).problems
63
+ for problem in problems:
64
+ print (problem.title)
65
+
66
+ asyncio.run(main())
67
+ ```
68
+
69
+ Note: The async API is currently experimental and subject to changes.
70
+
47
71
## Contributing
48
72
49
73
Contributions are welcome! Please open an issue or submit a pull request.
@@ -77,42 +101,64 @@ If you find a bug or have a feature request, please open an issue on GitHub. Pro
77
101
78
102
## Todo List
79
103
80
- Methods of class `LuoguAPI`
81
-
82
- - [x] Problem
83
- - [x] get_problem_list
84
- - [x] get_team_problem_list
85
- - [x] get_problem
86
- - [x] get_problem_settings
87
- - [x] update_problem_settings
88
- - [x] update_testcases_settings
89
- - [x] create_problem
90
- - [x] delete_problem
91
- - [x] transfer_problem
92
- - [ ] download_testcases
93
- - [ ] upload_testcases
94
- - [x] User
95
- - [x] get_user
96
- - [x] get_user_info
97
- - [x] get_user_followings_list
98
- - [x] get_user_followers_list
99
- - [x] get_user_blacklist
100
- - [x] search_user
101
- - [x] UserOperation
102
- - [ ] login
103
- - [ ] logout
104
- - [x] me
105
- - [ ] submit_code
106
- - [x] get_created_problem_list
107
- - [ ] get_created_problemset_list
108
- - [ ] get_created_content_list
109
- - [ ] update_setting
110
- - [x] Miscs
111
- - [x] get_tags
112
- - [ ] get_captcha
113
- - [ ] sign_up
114
-
115
- Others
116
-
117
- - [ ] asyncLuoguAPI
118
- - [ ] staticLuoguAPI
104
+ API Implementation Status
105
+
106
+ ### Core APIs
107
+
108
+ - [x] Problem API
109
+ - [x] get_problem_list
110
+ - [x] get_team_problem_list
111
+ - [x] get_problem
112
+ - [x] get_problem_settings
113
+ - [x] update_problem_settings
114
+ - [x] update_testcases_settings
115
+ - [x] create_problem
116
+ - [x] delete_problem
117
+ - [x] transfer_problem
118
+ - [ ] download_testcases
119
+ - [ ] upload_testcases
120
+
121
+ - [x] User API
122
+ - [x] get_user
123
+ - [x] get_user_info
124
+ - [x] get_user_followings_list
125
+ - [x] get_user_followers_list
126
+ - [x] get_user_blacklist
127
+ - [x] search_user
128
+
129
+ - [-] User Operations
130
+ - [ ] login
131
+ - [ ] logout
132
+ - [x] me
133
+ - [ ] submit_code
134
+ - [x] get_created_problem_list
135
+ - [ ] get_created_problemset_list
136
+ - [ ] get_created_content_list
137
+ - [ ] update_setting
138
+
139
+ - [-] Miscellaneous
140
+ - [x] get_tags
141
+ - [ ] get_captcha
142
+ - [ ] sign_up
143
+
144
+ ### Alternative API Implementations
145
+
146
+ - [x] asyncLuoguAPI (Experimental)
147
+ - [x] Async versions of all implemented core APIs
148
+ - [ ] Performance optimizations
149
+ - [ ] Comprehensive error handling
150
+
151
+ - [ ] staticLuoguAPI
152
+ - [ ] Initial implementation
153
+ - [ ] Documentation
154
+
155
+ ### Test Cases and Documentation
156
+
157
+ Note: Test suite and documentation are planned for implementation after API features are stabilized. This includes:
158
+
159
+ - Comprehensive test coverage for both sync and async APIs
160
+ - API reference documentation with examples
161
+ - Integration test scenarios
162
+ - Development guides and best practices
163
+
164
+ These will be prioritized once the core functionality reaches a stable state.
0 commit comments