PyHiveLMS 5.12.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyhive/__init__.py +13 -0
- pyhive/client.py +355 -0
- pyhive/src/__init__.py +0 -0
- pyhive/src/authenticated_hive_client.py +250 -0
- pyhive/src/types/__init__.py +0 -0
- pyhive/src/types/assignment.py +192 -0
- pyhive/src/types/class_.py +113 -0
- pyhive/src/types/common.py +56 -0
- pyhive/src/types/core_item.py +22 -0
- pyhive/src/types/enums/__init__.py +0 -0
- pyhive/src/types/enums/action_enum.py +18 -0
- pyhive/src/types/enums/assignment_status_enum.py +17 -0
- pyhive/src/types/enums/class_type_enum.py +13 -0
- pyhive/src/types/enums/clearance_enum.py +16 -0
- pyhive/src/types/enums/event_type_enum.py +14 -0
- pyhive/src/types/enums/exercise_patbas_enum.py +15 -0
- pyhive/src/types/enums/exercise_preview_types.py +15 -0
- pyhive/src/types/enums/form_field_type_enum.py +15 -0
- pyhive/src/types/enums/gender_enum.py +14 -0
- pyhive/src/types/enums/help_response_type_enum.py +14 -0
- pyhive/src/types/enums/help_status_enum.py +13 -0
- pyhive/src/types/enums/help_type_enum.py +18 -0
- pyhive/src/types/enums/queue_rule_enum.py +15 -0
- pyhive/src/types/enums/status_enum.py +21 -0
- pyhive/src/types/enums/sync_status_enum.py +15 -0
- pyhive/src/types/enums/visibility_enum.py +14 -0
- pyhive/src/types/event.py +140 -0
- pyhive/src/types/event_attendees_type_0_item.py +69 -0
- pyhive/src/types/event_color.py +63 -0
- pyhive/src/types/exercise.py +192 -0
- pyhive/src/types/form_field.py +149 -0
- pyhive/src/types/help_.py +275 -0
- pyhive/src/types/help_response.py +113 -0
- pyhive/src/types/help_response_segel_nested.py +129 -0
- pyhive/src/types/module.py +107 -0
- pyhive/src/types/notification_nested.py +80 -0
- pyhive/src/types/program.py +172 -0
- pyhive/src/types/queue.py +150 -0
- pyhive/src/types/queue_item.py +88 -0
- pyhive/src/types/subject.py +116 -0
- pyhive/src/types/tag.py +62 -0
- pyhive/src/types/user.py +375 -0
- pyhivelms-5.12.0.dist-info/METADATA +92 -0
- pyhivelms-5.12.0.dist-info/RECORD +45 -0
- pyhivelms-5.12.0.dist-info/WHEEL +4 -0
pyhive/src/types/user.py
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"""Hive management course user type."""
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Self, TypeVar, cast
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field
|
|
9
|
+
from dateutil.parser import isoparse
|
|
10
|
+
from src.types.common import UNSET, Unset
|
|
11
|
+
from src.types.core_item import HiveCoreItem
|
|
12
|
+
from src.types.enums.clearance_enum import ClearanceEnum
|
|
13
|
+
from src.types.enums.gender_enum import GenderEnum
|
|
14
|
+
from src.types.enums.status_enum import StatusEnum
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from client import HiveClient
|
|
18
|
+
from src.types.assignment import Assignment
|
|
19
|
+
from src.types.class_ import Class
|
|
20
|
+
from src.types.program import Program
|
|
21
|
+
from src.types.queue import Queue
|
|
22
|
+
|
|
23
|
+
T = TypeVar("T", bound="User")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@_attrs_define
|
|
27
|
+
class User(HiveCoreItem): # pylint: disable=too-many-instance-attributes
|
|
28
|
+
"""Hive management course user.
|
|
29
|
+
|
|
30
|
+
Attributes:
|
|
31
|
+
id (int):
|
|
32
|
+
display_name (str):
|
|
33
|
+
clearance (ClearanceEnum):
|
|
34
|
+
* `1` - Hanich
|
|
35
|
+
* `2` - Checker
|
|
36
|
+
* `3` - Segel
|
|
37
|
+
* `5` - Admin
|
|
38
|
+
gender (GenderEnum):
|
|
39
|
+
* `Male` - Male
|
|
40
|
+
* `Female` - Female
|
|
41
|
+
* `NonBinary` - Nonbinary
|
|
42
|
+
current_assignment (Union[None, int]):
|
|
43
|
+
current_assignment_options (list[int]):
|
|
44
|
+
mentees (list[int]):
|
|
45
|
+
username (str): Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
|
|
46
|
+
status (StatusEnum):
|
|
47
|
+
* `Present` - Present
|
|
48
|
+
* `Raised Hand` - Raisedhand
|
|
49
|
+
* `Toilet Request` - Toiletrequest
|
|
50
|
+
* `Toilet` - Toilet
|
|
51
|
+
* `Personal Talk` - Personaltalk
|
|
52
|
+
* `Work Talk` - Worktalk
|
|
53
|
+
* `Medical` - Medical
|
|
54
|
+
* `Prayer` - Prayer
|
|
55
|
+
* `Room` - Room
|
|
56
|
+
* `Home` - Home
|
|
57
|
+
status_date (datetime.datetime):
|
|
58
|
+
avatar_filename (Union[Unset, str]):
|
|
59
|
+
number (Union[None, Unset, int]):
|
|
60
|
+
program (Union[None, Unset, int]):
|
|
61
|
+
checkers_brief (Union[Unset, str]):
|
|
62
|
+
mentor (Union[None, Unset, int]):
|
|
63
|
+
classes (Union[Unset, list[int]]):
|
|
64
|
+
first_name (Union[Unset, str]):
|
|
65
|
+
last_name (Union[Unset, str]):
|
|
66
|
+
queue (Union[None, Unset, int]):
|
|
67
|
+
disable_queue (Union[Unset, bool]):
|
|
68
|
+
user_queue (Union[None, Unset, int]):
|
|
69
|
+
disable_user_queue (Union[Unset, bool]):
|
|
70
|
+
override_queue (Union[None, Unset, int]):
|
|
71
|
+
confirmed (Union[Unset, bool]):
|
|
72
|
+
teacher (Union[Unset, bool]):
|
|
73
|
+
hostname (Union[Unset, str]):
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
hive_client: "HiveClient"
|
|
78
|
+
id: int
|
|
79
|
+
display_name: str
|
|
80
|
+
clearance: ClearanceEnum
|
|
81
|
+
gender: GenderEnum
|
|
82
|
+
current_assignment_id: None | int
|
|
83
|
+
_current_assignment: "Assignment | None" = field(init=False, default=None)
|
|
84
|
+
current_assignment_options: list[int]
|
|
85
|
+
mentee_ids: list[int]
|
|
86
|
+
_mentees: "list[User] | None" = field(init=False, default=None)
|
|
87
|
+
username: str
|
|
88
|
+
status: StatusEnum
|
|
89
|
+
status_date: datetime.datetime
|
|
90
|
+
avatar_filename: Unset | str = UNSET
|
|
91
|
+
number: None | Unset | int = UNSET
|
|
92
|
+
program_id: None | Unset | int = UNSET
|
|
93
|
+
_program: "Program | None" = field(init=False, default=None)
|
|
94
|
+
checkers_brief: Unset | str = UNSET
|
|
95
|
+
mentor_id: None | Unset | int = UNSET
|
|
96
|
+
_mentor: "User | None" = field(init=False, default=None)
|
|
97
|
+
class_ids: Unset | list[int] = UNSET
|
|
98
|
+
_classes: "list[Class] | None" = field(init=False, default=None)
|
|
99
|
+
first_name: Unset | str = UNSET
|
|
100
|
+
last_name: Unset | str = UNSET
|
|
101
|
+
queue_id: None | Unset | int = UNSET
|
|
102
|
+
_queue: "Queue | None" = field(init=False, default=None)
|
|
103
|
+
disable_queue: Unset | bool = UNSET
|
|
104
|
+
user_queue_id: None | Unset | int = UNSET
|
|
105
|
+
_user_queue: "Queue | None" = field(init=False, default=None)
|
|
106
|
+
disable_user_queue: Unset | bool = UNSET
|
|
107
|
+
override_queue_id: None | Unset | int = UNSET
|
|
108
|
+
_override_queue: "Queue | None" = field(init=False, default=None)
|
|
109
|
+
confirmed: Unset | bool = UNSET
|
|
110
|
+
teacher: Unset | bool = UNSET
|
|
111
|
+
hostname: Unset | str = UNSET
|
|
112
|
+
|
|
113
|
+
def to_dict( # pylint: disable=too-many-locals, too-many-statements, too-many-branches
|
|
114
|
+
self,
|
|
115
|
+
) -> dict[str, Any]:
|
|
116
|
+
id = self.id
|
|
117
|
+
|
|
118
|
+
display_name = self.display_name
|
|
119
|
+
|
|
120
|
+
clearance = self.clearance.value
|
|
121
|
+
|
|
122
|
+
gender = self.gender.value
|
|
123
|
+
|
|
124
|
+
current_assignment_id: None | int
|
|
125
|
+
current_assignment_id = self.current_assignment_id
|
|
126
|
+
|
|
127
|
+
current_assignment_options = self.current_assignment_options
|
|
128
|
+
|
|
129
|
+
mentee_ids = self.mentee_ids
|
|
130
|
+
|
|
131
|
+
username = self.username
|
|
132
|
+
|
|
133
|
+
status = self.status.value
|
|
134
|
+
|
|
135
|
+
status_date = self.status_date.isoformat()
|
|
136
|
+
|
|
137
|
+
avatar_filename = self.avatar_filename
|
|
138
|
+
|
|
139
|
+
number: None | Unset | int
|
|
140
|
+
number = UNSET if isinstance(self.number, Unset) else self.number
|
|
141
|
+
|
|
142
|
+
program_id: None | Unset | int
|
|
143
|
+
program_id = UNSET if isinstance(self.program_id, Unset) else self.program_id
|
|
144
|
+
|
|
145
|
+
checkers_brief = self.checkers_brief
|
|
146
|
+
|
|
147
|
+
mentor_id: None | Unset | int
|
|
148
|
+
mentor_id = UNSET if isinstance(self.mentor_id, Unset) else self.mentor_id
|
|
149
|
+
|
|
150
|
+
class_ids: Unset | list[int] = UNSET
|
|
151
|
+
if not isinstance(self.class_ids, Unset):
|
|
152
|
+
class_ids = self.class_ids
|
|
153
|
+
|
|
154
|
+
first_name = self.first_name
|
|
155
|
+
|
|
156
|
+
last_name = self.last_name
|
|
157
|
+
|
|
158
|
+
queue_id: None | Unset | int
|
|
159
|
+
queue_id = UNSET if isinstance(self.queue_id, Unset) else self.queue_id
|
|
160
|
+
|
|
161
|
+
disable_queue = self.disable_queue
|
|
162
|
+
|
|
163
|
+
user_queue_id: None | Unset | int
|
|
164
|
+
user_queue_id = (
|
|
165
|
+
UNSET if isinstance(self.user_queue_id, Unset) else self.user_queue_id
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
disable_user_queue = self.disable_user_queue
|
|
169
|
+
|
|
170
|
+
override_queue_id: None | Unset | int
|
|
171
|
+
override_queue_id = (
|
|
172
|
+
UNSET
|
|
173
|
+
if isinstance(self.override_queue_id, Unset)
|
|
174
|
+
else self.override_queue_id
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
confirmed = self.confirmed
|
|
178
|
+
|
|
179
|
+
teacher = self.teacher
|
|
180
|
+
|
|
181
|
+
hostname = self.hostname
|
|
182
|
+
|
|
183
|
+
field_dict: dict[str, Any] = {}
|
|
184
|
+
field_dict.update(
|
|
185
|
+
{
|
|
186
|
+
"id": id,
|
|
187
|
+
"display_name": display_name,
|
|
188
|
+
"clearance": clearance,
|
|
189
|
+
"gender": gender,
|
|
190
|
+
"current_assignment": current_assignment_id,
|
|
191
|
+
"current_assignment_options": current_assignment_options,
|
|
192
|
+
"mentees": mentee_ids,
|
|
193
|
+
"username": username,
|
|
194
|
+
"status": status,
|
|
195
|
+
"status_date": status_date,
|
|
196
|
+
},
|
|
197
|
+
)
|
|
198
|
+
if avatar_filename is not UNSET:
|
|
199
|
+
field_dict["avatar_filename"] = avatar_filename
|
|
200
|
+
if number is not UNSET:
|
|
201
|
+
field_dict["number"] = number
|
|
202
|
+
if program_id is not UNSET:
|
|
203
|
+
field_dict["program"] = program_id
|
|
204
|
+
if checkers_brief is not UNSET:
|
|
205
|
+
field_dict["checkers_brief"] = checkers_brief
|
|
206
|
+
if mentor_id is not UNSET:
|
|
207
|
+
field_dict["mentor"] = mentor_id
|
|
208
|
+
if class_ids is not UNSET:
|
|
209
|
+
field_dict["classes"] = class_ids
|
|
210
|
+
if first_name is not UNSET:
|
|
211
|
+
field_dict["first_name"] = first_name
|
|
212
|
+
if last_name is not UNSET:
|
|
213
|
+
field_dict["last_name"] = last_name
|
|
214
|
+
if queue_id is not UNSET:
|
|
215
|
+
field_dict["queue"] = queue_id
|
|
216
|
+
if disable_queue is not UNSET:
|
|
217
|
+
field_dict["disable_queue"] = disable_queue
|
|
218
|
+
if user_queue_id is not UNSET:
|
|
219
|
+
field_dict["user_queue"] = user_queue_id
|
|
220
|
+
if disable_user_queue is not UNSET:
|
|
221
|
+
field_dict["disable_user_queue"] = disable_user_queue
|
|
222
|
+
if override_queue_id is not UNSET:
|
|
223
|
+
field_dict["override_queue"] = override_queue_id
|
|
224
|
+
if confirmed is not UNSET:
|
|
225
|
+
field_dict["confirmed"] = confirmed
|
|
226
|
+
if teacher is not UNSET:
|
|
227
|
+
field_dict["teacher"] = teacher
|
|
228
|
+
if hostname is not UNSET:
|
|
229
|
+
field_dict["hostname"] = hostname
|
|
230
|
+
|
|
231
|
+
return field_dict
|
|
232
|
+
|
|
233
|
+
@classmethod
|
|
234
|
+
def from_dict(cls, src_dict: Mapping[str, Any], hive_client: "HiveClient") -> Self: # pylint: disable=too-many-locals
|
|
235
|
+
"""Deserialize a User instance from a mapping."""
|
|
236
|
+
d = dict(src_dict)
|
|
237
|
+
id = d.pop("id")
|
|
238
|
+
|
|
239
|
+
display_name = d.pop("display_name")
|
|
240
|
+
|
|
241
|
+
clearance = ClearanceEnum(d.pop("clearance"))
|
|
242
|
+
|
|
243
|
+
gender = GenderEnum(d.pop("gender"))
|
|
244
|
+
|
|
245
|
+
def _parse_current_assignment(data: object) -> None | int:
|
|
246
|
+
if data is None:
|
|
247
|
+
return data
|
|
248
|
+
return cast("None | int", data)
|
|
249
|
+
|
|
250
|
+
current_assignment = _parse_current_assignment(d.pop("current_assignment"))
|
|
251
|
+
|
|
252
|
+
current_assignment_options = cast(
|
|
253
|
+
"list[int]", d.pop("current_assignment_options")
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
mentees = cast("list[int]", d.pop("mentees"))
|
|
257
|
+
|
|
258
|
+
username = d.pop("username")
|
|
259
|
+
|
|
260
|
+
status = StatusEnum(d.pop("status"))
|
|
261
|
+
|
|
262
|
+
status_date = isoparse(d.pop("status_date"))
|
|
263
|
+
|
|
264
|
+
avatar_filename = d.pop("avatar_filename", UNSET)
|
|
265
|
+
|
|
266
|
+
def _parse_number(data: object) -> None | Unset | int:
|
|
267
|
+
if data is None:
|
|
268
|
+
return data
|
|
269
|
+
if isinstance(data, Unset):
|
|
270
|
+
return data
|
|
271
|
+
return cast("None | Unset | int", data)
|
|
272
|
+
|
|
273
|
+
number = _parse_number(d.pop("number", UNSET))
|
|
274
|
+
|
|
275
|
+
def _parse_program(data: object) -> None | Unset | int:
|
|
276
|
+
if data is None:
|
|
277
|
+
return data
|
|
278
|
+
if isinstance(data, Unset):
|
|
279
|
+
return data
|
|
280
|
+
return cast("None | Unset | int", data)
|
|
281
|
+
|
|
282
|
+
program = _parse_program(d.pop("program", UNSET))
|
|
283
|
+
|
|
284
|
+
checkers_brief = d.pop("checkers_brief", UNSET)
|
|
285
|
+
|
|
286
|
+
def _parse_mentor(data: object) -> None | Unset | int:
|
|
287
|
+
if data is None:
|
|
288
|
+
return data
|
|
289
|
+
if isinstance(data, Unset):
|
|
290
|
+
return data
|
|
291
|
+
return cast("None | Unset | int", data)
|
|
292
|
+
|
|
293
|
+
mentor = _parse_mentor(d.pop("mentor", UNSET))
|
|
294
|
+
|
|
295
|
+
classes = cast("list[int]", d.pop("classes", UNSET))
|
|
296
|
+
|
|
297
|
+
first_name = d.pop("first_name", UNSET)
|
|
298
|
+
|
|
299
|
+
last_name = d.pop("last_name", UNSET)
|
|
300
|
+
|
|
301
|
+
def _parse_queue(data: object) -> None | Unset | int:
|
|
302
|
+
if data is None:
|
|
303
|
+
return data
|
|
304
|
+
if isinstance(data, Unset):
|
|
305
|
+
return data
|
|
306
|
+
return cast("None | Unset | int", data)
|
|
307
|
+
|
|
308
|
+
queue = _parse_queue(d.pop("queue", UNSET))
|
|
309
|
+
|
|
310
|
+
disable_queue = d.pop("disable_queue", UNSET)
|
|
311
|
+
|
|
312
|
+
def _parse_user_queue(data: object) -> None | Unset | int:
|
|
313
|
+
if data is None:
|
|
314
|
+
return data
|
|
315
|
+
if isinstance(data, Unset):
|
|
316
|
+
return data
|
|
317
|
+
return cast("None | Unset | int", data)
|
|
318
|
+
|
|
319
|
+
user_queue = _parse_user_queue(d.pop("user_queue", UNSET))
|
|
320
|
+
|
|
321
|
+
disable_user_queue = d.pop("disable_user_queue", UNSET)
|
|
322
|
+
|
|
323
|
+
def _parse_override_queue(data: object) -> None | Unset | int:
|
|
324
|
+
if data is None:
|
|
325
|
+
return data
|
|
326
|
+
if isinstance(data, Unset):
|
|
327
|
+
return data
|
|
328
|
+
return cast("None | Unset | int", data)
|
|
329
|
+
|
|
330
|
+
override_queue = _parse_override_queue(d.pop("override_queue", UNSET))
|
|
331
|
+
|
|
332
|
+
confirmed = d.pop("confirmed", UNSET)
|
|
333
|
+
|
|
334
|
+
teacher = d.pop("teacher", UNSET)
|
|
335
|
+
|
|
336
|
+
hostname = d.pop("hostname", UNSET)
|
|
337
|
+
|
|
338
|
+
return cls(
|
|
339
|
+
id=id,
|
|
340
|
+
display_name=display_name,
|
|
341
|
+
clearance=clearance,
|
|
342
|
+
gender=gender,
|
|
343
|
+
current_assignment_id=current_assignment,
|
|
344
|
+
current_assignment_options=current_assignment_options,
|
|
345
|
+
mentee_ids=mentees,
|
|
346
|
+
username=username,
|
|
347
|
+
status=status,
|
|
348
|
+
status_date=status_date,
|
|
349
|
+
avatar_filename=avatar_filename,
|
|
350
|
+
number=number,
|
|
351
|
+
program_id=program,
|
|
352
|
+
checkers_brief=checkers_brief,
|
|
353
|
+
mentor_id=mentor,
|
|
354
|
+
class_ids=classes,
|
|
355
|
+
first_name=first_name,
|
|
356
|
+
last_name=last_name,
|
|
357
|
+
queue_id=queue,
|
|
358
|
+
disable_queue=disable_queue,
|
|
359
|
+
user_queue_id=user_queue,
|
|
360
|
+
disable_user_queue=disable_user_queue,
|
|
361
|
+
override_queue_id=override_queue,
|
|
362
|
+
confirmed=confirmed,
|
|
363
|
+
teacher=teacher,
|
|
364
|
+
hostname=hostname,
|
|
365
|
+
hive_client=hive_client,
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
@property
|
|
369
|
+
def program(self) -> "Program | None":
|
|
370
|
+
"""The program this user is in."""
|
|
371
|
+
if not isinstance(self.program_id, int):
|
|
372
|
+
return None
|
|
373
|
+
if self._program is None:
|
|
374
|
+
self._program = self.hive_client.get_program(self.program_id)
|
|
375
|
+
return self._program
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyHiveLMS
|
|
3
|
+
Version: 5.12.0
|
|
4
|
+
Summary: Python bindings for Hive
|
|
5
|
+
Author-email: "Michael K. Steinberg" <m.kuper.steinberg@gmail.com>
|
|
6
|
+
Requires-Python: >=3.11.0
|
|
7
|
+
Requires-Dist: httpx
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# pyhive — a stupid simple Hive Python API
|
|
12
|
+
|
|
13
|
+
Lightweight, no-fuss Python client for the Hive service used in this repo. It exposes a small, synchronous HTTP client (as a context manager) and typed model objects for common Hive resources like programs, subjects, modules, exercises and users.
|
|
14
|
+
|
|
15
|
+
## Highlights
|
|
16
|
+
- Minimal, dependency-light wrapper around the Hive API
|
|
17
|
+
- Generator-based list endpoints for memory-efficient iteration
|
|
18
|
+
- Typed model objects under `src.types` for convenience
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
This project uses plain Python. From the repository root you can install the development requirements or install the package locally.
|
|
22
|
+
|
|
23
|
+
1) Create and activate a virtualenv (recommended)
|
|
24
|
+
|
|
25
|
+
Windows (PowerShell):
|
|
26
|
+
|
|
27
|
+
```pwsh
|
|
28
|
+
python -m venv .venv
|
|
29
|
+
.\.venv\Scripts\Activate.ps1
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
2) Install dependencies
|
|
33
|
+
|
|
34
|
+
```pwsh
|
|
35
|
+
pip install -r requirements.txt
|
|
36
|
+
# or install the package in editable mode
|
|
37
|
+
pip install -e .
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quickstart
|
|
41
|
+
The main client class is `HiveClient` in `pyhive.client`. It is used as a context manager to ensure proper session/login handling.
|
|
42
|
+
|
|
43
|
+
Example — list programs and print their ids and names:
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from pyhive.client import HiveClient
|
|
47
|
+
|
|
48
|
+
USERNAME = "yourusername"
|
|
49
|
+
PASSWORD = "yourpassword"
|
|
50
|
+
HIVE_URL = "https://hive.example.com"
|
|
51
|
+
|
|
52
|
+
with HiveClient(USERNAME, PASSWORD, HIVE_URL) as client:
|
|
53
|
+
for program in client.get_course_programs():
|
|
54
|
+
print(program.id, program.name)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Example — fetch a program by id:
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
with HiveClient(USERNAME, PASSWORD, HIVE_URL) as client:
|
|
61
|
+
program = client.get_program(42)
|
|
62
|
+
print(program.name, program.description)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Notes on generators: list-style endpoints (e.g. `get_course_programs`, `get_exercises`, `get_users`, `get_classes`) return generators of typed model objects — iterate over them or convert to a list if you need random access.
|
|
66
|
+
|
|
67
|
+
## API contract (short)
|
|
68
|
+
- Initialization: `HiveClient(username: str, password: str, hive_url: str, **kwargs)`
|
|
69
|
+
- Common methods return either a single typed object (e.g. `get_program(id)`) or a generator of objects (e.g. `get_course_programs()`)
|
|
70
|
+
- Model classes provide `.from_dict(...)` constructors and are found under `src.types`.
|
|
71
|
+
|
|
72
|
+
Error handling: HTTP-level errors raised by the underlying request logic will surface; catch exceptions around client calls as needed.
|
|
73
|
+
|
|
74
|
+
## Tests
|
|
75
|
+
Run the unit tests with pytest from the repository root:
|
|
76
|
+
|
|
77
|
+
```pwsh
|
|
78
|
+
pip install -r requirements.txt
|
|
79
|
+
pytest -q
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Contributing
|
|
83
|
+
- Open an issue or PR for changes
|
|
84
|
+
- Keep changes focused and small; prefer adding tests for new behavior
|
|
85
|
+
|
|
86
|
+
## Files of interest
|
|
87
|
+
- `pyhive/client.py` — the high-level client class you will use
|
|
88
|
+
- `src/types/` — typed model objects created from API responses
|
|
89
|
+
- `tests/` — unit tests and examples of client usage
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
This repository does not include a formal license file. Add a LICENSE if you plan to publish or share this package.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
pyhive/__init__.py,sha256=kCvWR_847-zXI1Wvz54ZSlUG1XgNsKdxxUnpZmY3JqE,406
|
|
2
|
+
pyhive/client.py,sha256=MYO7AoYxFQnkf2u2-VMwOiTeuVNbeP9CAtuPydUVoqg,10965
|
|
3
|
+
pyhive/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
pyhive/src/authenticated_hive_client.py,sha256=u6YxLYg1e2p8sDiC72iWlEb221eExv-0ppbZBjpnvm0,8459
|
|
5
|
+
pyhive/src/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
pyhive/src/types/assignment.py,sha256=wTk6UrUMcmH6yR3cSGk5OJZ4ZCSE5B4xcwuzNYyDAUU,7703
|
|
7
|
+
pyhive/src/types/class_.py,sha256=rZPOYkGSiVQxs8ELt6jIgntL0jfcjKVefLYoM0sC-QI,3666
|
|
8
|
+
pyhive/src/types/common.py,sha256=ZqvRt31LiOen6OJAr3fqdlKjwm87l5STh_gX5vSS2vQ,1459
|
|
9
|
+
pyhive/src/types/core_item.py,sha256=CuLnEIjAHXEs9wCEkHxmU-YjukgTguCdFuy-ugGJvL4,620
|
|
10
|
+
pyhive/src/types/event.py,sha256=YZG6cD82_I6uQTSm3byMlwRlCpaMxkUOFLikFesPyl8,5009
|
|
11
|
+
pyhive/src/types/event_attendees_type_0_item.py,sha256=uSS1vcRHjPdHan2eZpXDZ9yTd3C9kNnNL6xApQQv8og,1584
|
|
12
|
+
pyhive/src/types/event_color.py,sha256=nZMg9PkEKVs1bnoenlS3mKVngPSx0bIGPstrS0p5Dhc,1297
|
|
13
|
+
pyhive/src/types/exercise.py,sha256=glxJwz6XSN7LYmdcUIWLp1IK7EZnkc-6sB7LqAVX-qA,7742
|
|
14
|
+
pyhive/src/types/form_field.py,sha256=TKOod2Zoy15xeKUVDUmHarQYohdjFPSnDx-oXX8ZhiU,5426
|
|
15
|
+
pyhive/src/types/help_.py,sha256=qAm6Wk3LTzbdgQezy5K62HMezXvuN6vHrfqpmNLqfXc,8883
|
|
16
|
+
pyhive/src/types/help_response.py,sha256=GznWHto7YrYPxhLZtXD7D2pCEsNiUiyE2c-s2R6G1Pk,3913
|
|
17
|
+
pyhive/src/types/help_response_segel_nested.py,sha256=blRiDk79KklcapdFSPQJ1C1lZ-U5Ri75B1jBucklO1c,3682
|
|
18
|
+
pyhive/src/types/module.py,sha256=ksZLAgq5fnn5Z_zR1qKHVqPx5ZBb6UvaQn2_dvEoVnI,3736
|
|
19
|
+
pyhive/src/types/notification_nested.py,sha256=Dph6phG3uanZ5MF8J1HvXzM_hLsFH-MHKtvv_gunuzE,2474
|
|
20
|
+
pyhive/src/types/program.py,sha256=ncgUJEzhUa_x-Zf1f8cN3xrXnn-728JiP40gtauVmCA,6809
|
|
21
|
+
pyhive/src/types/queue.py,sha256=UcTV4Edaviz6jgsioNYGU75qaZIsC8JRHdDw2-WNO4c,5440
|
|
22
|
+
pyhive/src/types/queue_item.py,sha256=lqqBgjDm6Y99NdPCVa3A9a8SJcGb81YfDDbc7YiB65E,3029
|
|
23
|
+
pyhive/src/types/subject.py,sha256=SseTYTsl20x1GF-DsD86gii9nU_uLxSXUO7eaof9LJ8,3851
|
|
24
|
+
pyhive/src/types/tag.py,sha256=PrlzcnGFbh6XgnG6A8Eu9in_yRbw48vOHqPathizxAo,1214
|
|
25
|
+
pyhive/src/types/user.py,sha256=MwtxCchYu6SkTBOqTZl_Mwtf31pc9d1q5cRGJ3xWiNs,12420
|
|
26
|
+
pyhive/src/types/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
+
pyhive/src/types/enums/action_enum.py,sha256=S4W6h-wlQoF_qqslfGqtH6oBZUa73rEgGOwzYv_8ZRw,407
|
|
28
|
+
pyhive/src/types/enums/assignment_status_enum.py,sha256=ZrJTJoebReGLtAaZbrirJiG5E-a88LIynvUerCXJLro,380
|
|
29
|
+
pyhive/src/types/enums/class_type_enum.py,sha256=IhY48Uny5BDm3Pm3s-YFsyrabej-m_ASlN5NmvagEs0,246
|
|
30
|
+
pyhive/src/types/enums/clearance_enum.py,sha256=HX-yJ8Lsmew45vCbxc5cpqYv2pAI44e0Mvik3oLcUhw,359
|
|
31
|
+
pyhive/src/types/enums/event_type_enum.py,sha256=CpzWelmTzfK9IuSis-oFojkMep4-LjN9tghvfVWUOjY,414
|
|
32
|
+
pyhive/src/types/enums/exercise_patbas_enum.py,sha256=34ZTpd7k06voBDRlqfNlXiZhYJbCHBRelpK-T6ng1LA,296
|
|
33
|
+
pyhive/src/types/enums/exercise_preview_types.py,sha256=j86WKWKpmRzNGXWIo9_s2GOpGNXNHber3T037EGAdlk,355
|
|
34
|
+
pyhive/src/types/enums/form_field_type_enum.py,sha256=v2vb1WrmD3TDD9pCRCHkVv1eFFc-flB706hk_x3OlJk,335
|
|
35
|
+
pyhive/src/types/enums/gender_enum.py,sha256=O0MK7H08VkfRWpM4LRNxr88oij7SLUXjDqcrUFMQsHg,260
|
|
36
|
+
pyhive/src/types/enums/help_response_type_enum.py,sha256=XKO99KflEqch1PZRdWGBTrXpo7s2dLALF2PRb092r4k,308
|
|
37
|
+
pyhive/src/types/enums/help_status_enum.py,sha256=u2EGVw4v9lQyo8cEQoj5tA0jcVlgqXfrOcL-LtoVEwo,215
|
|
38
|
+
pyhive/src/types/enums/help_type_enum.py,sha256=gQe-2T1u1fKEnAtdrEm5Ph58Kp-h3iyoj7rvuAZv0ow,384
|
|
39
|
+
pyhive/src/types/enums/queue_rule_enum.py,sha256=t_WqpevMrHu0JtttbYlI3pbGEi2iK9e4n31D4xwkQJc,364
|
|
40
|
+
pyhive/src/types/enums/status_enum.py,sha256=AZM_5dfrr3LT1kfFwwMaionNM_DgdgpguWhcoCjcgXs,478
|
|
41
|
+
pyhive/src/types/enums/sync_status_enum.py,sha256=5HO_Xd0nS03252SbDfziXQubvaQ9YLvrjczdV2rt-Lk,338
|
|
42
|
+
pyhive/src/types/enums/visibility_enum.py,sha256=dq1vNHg_i247irxWyBzXNST1tPiS46TpH9r1WmfwOZ0,355
|
|
43
|
+
pyhivelms-5.12.0.dist-info/METADATA,sha256=f8_g6K3P_rDDPj759rVJpeHfJ0Ng5hvt531xI91mhgE,3088
|
|
44
|
+
pyhivelms-5.12.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
45
|
+
pyhivelms-5.12.0.dist-info/RECORD,,
|