usos-api 0.4.1__tar.gz → 0.5.0__tar.gz

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.
Files changed (47) hide show
  1. {usos_api-0.4.1 → usos_api-0.5.0}/PKG-INFO +2 -2
  2. {usos_api-0.4.1 → usos_api-0.5.0}/pyproject.toml +1 -1
  3. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/client.py +3 -0
  4. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/__init__.py +3 -1
  5. usos_api-0.5.0/usos_api/models/programme.py +61 -0
  6. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/services/__init__.py +2 -0
  7. usos_api-0.5.0/usos_api/services/programmes.py +47 -0
  8. {usos_api-0.4.1 → usos_api-0.5.0}/uv.lock +1 -1
  9. usos_api-0.4.1/usos_api/models/programme.py +0 -34
  10. {usos_api-0.4.1 → usos_api-0.5.0}/.github/workflows/publish.yml +0 -0
  11. {usos_api-0.4.1 → usos_api-0.5.0}/.gitignore +0 -0
  12. {usos_api-0.4.1 → usos_api-0.5.0}/.readthedocs.yaml +0 -0
  13. {usos_api-0.4.1 → usos_api-0.5.0}/README.md +0 -0
  14. {usos_api-0.4.1 → usos_api-0.5.0}/docs/Makefile +0 -0
  15. {usos_api-0.4.1 → usos_api-0.5.0}/docs/conf.py +0 -0
  16. {usos_api-0.4.1 → usos_api-0.5.0}/docs/full-docs.rst +0 -0
  17. {usos_api-0.4.1 → usos_api-0.5.0}/docs/index.rst +0 -0
  18. {usos_api-0.4.1 → usos_api-0.5.0}/docs/make.bat +0 -0
  19. {usos_api-0.4.1 → usos_api-0.5.0}/docs/quickstart.rst +0 -0
  20. {usos_api-0.4.1 → usos_api-0.5.0}/run.py +0 -0
  21. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/__init__.py +0 -0
  22. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/auth.py +0 -0
  23. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/connection.py +0 -0
  24. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/exceptions.py +0 -0
  25. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/helper.py +0 -0
  26. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/logger.py +0 -0
  27. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/api_documentation.py +0 -0
  28. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/consumer.py +0 -0
  29. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/course.py +0 -0
  30. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/exam_report.py +0 -0
  31. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/grade.py +0 -0
  32. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/group.py +0 -0
  33. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/lang_dict.py +0 -0
  34. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/registration.py +0 -0
  35. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/term.py +0 -0
  36. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/user.py +0 -0
  37. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/models/usos_bool.py +0 -0
  38. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/services/api_documentation.py +0 -0
  39. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/services/api_server.py +0 -0
  40. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/services/courses.py +0 -0
  41. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/services/exam_reports.py +0 -0
  42. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/services/grades.py +0 -0
  43. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/services/groups.py +0 -0
  44. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/services/registrations.py +0 -0
  45. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/services/terms.py +0 -0
  46. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/services/users.py +0 -0
  47. {usos_api-0.4.1 → usos_api-0.5.0}/usos_api/utils/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: usos-api
3
- Version: 0.4.1
3
+ Version: 0.5.0
4
4
  Summary: Asynchronous USOS API for Python
5
5
  Project-URL: Homepage, https://github.com/Antoni-Czaplicki/usos-api
6
6
  Project-URL: Repository, https://github.com/Antoni-Czaplicki/usos-api
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "usos-api"
3
- version = "0.4.1"
3
+ version = "0.5.0"
4
4
  description = "Asynchronous USOS API for Python"
5
5
  authors = [
6
6
  { name = "Antoni-Czaplicki", email = "56671347+Antoni-Czaplicki@users.noreply.github.com" }
@@ -10,6 +10,7 @@ from .services import (
10
10
  ExamReportService,
11
11
  GradeService,
12
12
  GroupService,
13
+ ProgrammeService,
13
14
  RegistrationService,
14
15
  TermService,
15
16
  UserService,
@@ -31,6 +32,7 @@ class USOSClient:
31
32
  :var GradeService grade_service: The grade service.
32
33
  :var ExamReportService exam_report_service: The exam report service.
33
34
  :var RegistrationService registration_service: The registration service.
35
+ :var ProgrammeService programme_service: The programme service.
34
36
 
35
37
  :ivar USOSAPIConnection connection: The connection to the USOS API, used for making requests.
36
38
  """
@@ -62,6 +64,7 @@ class USOSClient:
62
64
  self.api_server_service = APIServerService(self.connection)
63
65
  self.api_documentation_service = APIDocumentationService(self.connection)
64
66
  self.registration_service = RegistrationService(self.connection)
67
+ self.programme_service = ProgrammeService(self.connection)
65
68
 
66
69
  self.helper = APIHelper(self)
67
70
 
@@ -44,7 +44,7 @@ from .exam_report import (
44
44
  from .grade import Grade
45
45
  from .group import Group
46
46
  from .lang_dict import LangDict
47
- from .programme import Programme, StudentProgramme
47
+ from .programme import Faculty, Programme, ProgrammeStage, StudentProgramme
48
48
  from .registration import (
49
49
  CoursesCart,
50
50
  Link,
@@ -89,6 +89,8 @@ __all__ = [
89
89
  "ExternalIds",
90
90
  "StudentProgramme",
91
91
  "Programme",
92
+ "ProgrammeStage",
93
+ "Faculty",
92
94
  "Sex",
93
95
  "LangDict",
94
96
  "CourseAttribute",
@@ -0,0 +1,61 @@
1
+ from datetime import date
2
+
3
+ from pydantic import BaseModel
4
+
5
+ from .lang_dict import LangDict
6
+
7
+
8
+ class Faculty(BaseModel):
9
+ """
10
+ Class representing a faculty.
11
+ """
12
+
13
+ id: str | None = None
14
+ name: LangDict | None = None
15
+ profile_url: str | None = None
16
+ homepage_url: str | None = None
17
+ postal_address: str | None = None
18
+ email: str | None = None
19
+ is_public: bool | None = None
20
+
21
+
22
+ class Programme(BaseModel):
23
+ """
24
+ Class representing a study programme.
25
+ """
26
+
27
+ id: str | None = None
28
+ name: LangDict | None = None
29
+ description: LangDict | None = None
30
+ faculty: Faculty | None = None
31
+ all_faculties: list[Faculty] | None = None
32
+ mode_of_studies: LangDict | None = None
33
+ level_of_studies: LangDict | None = None
34
+ duration: LangDict | None = None
35
+ professional_status: LangDict | None = None
36
+ level: str | None = None
37
+
38
+
39
+ class ProgrammeStage(BaseModel):
40
+ """
41
+ Class representing a stage of a programme a student is enrolled in.
42
+ """
43
+
44
+ id: str | None = None
45
+ name: LangDict | None = None
46
+ code: str | None = None
47
+ description: LangDict | None = None
48
+
49
+
50
+ class StudentProgramme(BaseModel):
51
+ """
52
+ Class representing a student programme a user is enrolled in.
53
+ """
54
+
55
+ id: str | None = None
56
+ user: dict | None = None
57
+ programme: Programme | None = None
58
+ status: str | None = None
59
+ admission_date: date | None = None
60
+ stages: list[ProgrammeStage] | None = []
61
+ is_primary: bool | None = None
@@ -4,6 +4,7 @@ from .courses import CourseService
4
4
  from .exam_reports import ExamReportService
5
5
  from .grades import GradeService
6
6
  from .groups import GroupService
7
+ from .programmes import ProgrammeService
7
8
  from .registrations import RegistrationService
8
9
  from .terms import TermService
9
10
  from .users import UserService
@@ -15,6 +16,7 @@ __all__ = [
15
16
  "ExamReportService",
16
17
  "GradeService",
17
18
  "GroupService",
19
+ "ProgrammeService",
18
20
  "TermService",
19
21
  "UserService",
20
22
  "RegistrationService",
@@ -0,0 +1,47 @@
1
+ from ..connection import USOSAPIConnection
2
+ from ..models import StudentProgramme
3
+
4
+
5
+ class ProgrammeService:
6
+ """
7
+ A service for programme-related operations.
8
+ """
9
+
10
+ def __init__(self, connection: USOSAPIConnection):
11
+ """
12
+ Initialize the programme service.
13
+
14
+ :param connection: The connection to use.
15
+ """
16
+ self.connection = connection
17
+
18
+ async def get_student_programmes(
19
+ self,
20
+ user_id: int | None = None,
21
+ fields: list[str] | None = None,
22
+ active_only: bool = True,
23
+ ) -> list[StudentProgramme]:
24
+ """
25
+ Get the programmes of a student.
26
+
27
+ :param user_id: The ID of the student. If None, the currently authorized user is used.
28
+ :param fields: The fields to include in the response. Whole list of fields can be found `here <https://apps.usos.pwr.edu.pl/developers/api/services/progs/#student_programme>`_.
29
+ :param active_only: Whether to get only programmes with the status `active` or `graduated_before_diploma`.
30
+ :return: The student programmes.
31
+ """
32
+ if fields is None:
33
+ fields = [
34
+ "id",
35
+ "status",
36
+ "admission_date",
37
+ "is_primary",
38
+ "stages",
39
+ "programme[id|name|faculty[id|name]]",
40
+ ] # Default fields
41
+ response = await self.connection.post(
42
+ "services/progs/student",
43
+ user_id=user_id,
44
+ fields="|".join(fields),
45
+ active_only="true" if active_only else "false",
46
+ )
47
+ return [StudentProgramme(**programme) for programme in response]
@@ -1490,7 +1490,7 @@ wheels = [
1490
1490
 
1491
1491
  [[package]]
1492
1492
  name = "usos-api"
1493
- version = "0.4.1"
1493
+ version = "0.5.0"
1494
1494
  source = { editable = "." }
1495
1495
  dependencies = [
1496
1496
  { name = "aiohttp" },
@@ -1,34 +0,0 @@
1
- from datetime import date
2
-
3
- from pydantic import BaseModel
4
-
5
-
6
- class Programme(BaseModel):
7
- """
8
- Class representing a study programme.
9
- """
10
-
11
- id: str | None = None
12
- name: dict | None = None
13
- description: dict | None = None
14
- faculty: dict | None = None
15
- all_faculties: list | None = None
16
- mode_of_studies: dict | None = None
17
- level_of_studies: dict | None = None
18
- duration: dict | None = None
19
- professional_status: dict | None = None
20
- level: str | None = None
21
-
22
-
23
- class StudentProgramme(BaseModel):
24
- """
25
- Class representing a student programme a user is enrolled in.
26
- """
27
-
28
- id: str | None = None
29
- user: dict | None = None
30
- programme: Programme | None = None
31
- status: str | None = None
32
- admission_date: date | None = None
33
- stages: list = []
34
- is_primary: bool | None = None
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes