edx-enterprise-subsidy-client 0.4.1__py2.py3-none-any.whl → 0.4.3__py2.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.
- edx_enterprise_subsidy_client/__init__.py +1 -1
- edx_enterprise_subsidy_client/client.py +35 -0
- {edx_enterprise_subsidy_client-0.4.1.dist-info → edx_enterprise_subsidy_client-0.4.3.dist-info}/METADATA +8 -1
- edx_enterprise_subsidy_client-0.4.3.dist-info/RECORD +8 -0
- {edx_enterprise_subsidy_client-0.4.1.dist-info → edx_enterprise_subsidy_client-0.4.3.dist-info}/WHEEL +1 -1
- edx_enterprise_subsidy_client-0.4.1.dist-info/RECORD +0 -8
- {edx_enterprise_subsidy_client-0.4.1.dist-info → edx_enterprise_subsidy_client-0.4.3.dist-info}/LICENSE +0 -0
- {edx_enterprise_subsidy_client-0.4.1.dist-info → edx_enterprise_subsidy_client-0.4.3.dist-info}/LICENSE.txt +0 -0
- {edx_enterprise_subsidy_client-0.4.1.dist-info → edx_enterprise_subsidy_client-0.4.3.dist-info}/top_level.txt +0 -0
|
@@ -73,6 +73,41 @@ class EnterpriseSubsidyAPIClient:
|
|
|
73
73
|
settings.BACKEND_SERVICE_EDX_OAUTH2_SECRET,
|
|
74
74
|
)
|
|
75
75
|
|
|
76
|
+
def get_subsidy_aggregates_by_learner_url(self, subsidy_uuid):
|
|
77
|
+
"""
|
|
78
|
+
Helper method to fetch subsidy learner aggregate data API url.
|
|
79
|
+
"""
|
|
80
|
+
return f"{self.SUBSIDIES_ENDPOINT}{subsidy_uuid}/aggregates-by-learner"
|
|
81
|
+
|
|
82
|
+
def get_subsidy_aggregates_by_learner_data(self, subsidy_uuid, policy_uuid=None):
|
|
83
|
+
"""
|
|
84
|
+
Client method to fetch subsidy specific learner aggregate data.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
subsidy_uuid (str): Subsidy record UUID
|
|
88
|
+
policy_uuid (string): Optional param to filter subsidy aggregate data by subsidy access policy UUID
|
|
89
|
+
Returns:
|
|
90
|
+
json subsidy learner aggregate data response:
|
|
91
|
+
[{
|
|
92
|
+
'lms_user_id': '1337',
|
|
93
|
+
'enrollment_count': 45,
|
|
94
|
+
} ... ]
|
|
95
|
+
"""
|
|
96
|
+
url = self.get_subsidy_aggregates_by_learner_url(subsidy_uuid)
|
|
97
|
+
if policy_uuid:
|
|
98
|
+
url += f"?subsidy_access_policy_uuid={policy_uuid}"
|
|
99
|
+
try:
|
|
100
|
+
resp = self.client.get(url)
|
|
101
|
+
response_data = resp
|
|
102
|
+
resp.raise_for_status()
|
|
103
|
+
except requests.exceptions.HTTPError as exc:
|
|
104
|
+
logger.exception(
|
|
105
|
+
f'Subsidy client failed to fetch aggregate data for {subsidy_uuid} '
|
|
106
|
+
f'and policy: {policy_uuid}'
|
|
107
|
+
)
|
|
108
|
+
raise exc
|
|
109
|
+
return response_data.json()
|
|
110
|
+
|
|
76
111
|
def get_content_metadata_url(self, content_identifier):
|
|
77
112
|
"""Helper method to generate the subsidy service metadata API url, with a trailing slash."""
|
|
78
113
|
return self.CONTENT_METADATA_ENDPOINT + content_identifier + '/'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: edx-enterprise-subsidy-client
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: Client for interacting with the enterprise-subsidy service.
|
|
5
5
|
Home-page: https://github.com/openedx/edx-enterprise-subsidy-client
|
|
6
6
|
Author: edX
|
|
@@ -225,8 +225,15 @@ Change Log
|
|
|
225
225
|
Unreleased
|
|
226
226
|
**********
|
|
227
227
|
|
|
228
|
+
[0.4.3]
|
|
229
|
+
*******
|
|
230
|
+
* feat: adding new subsidy client method to fetch subsidy aggregate data
|
|
231
|
+
|
|
232
|
+
[0.4.2]
|
|
233
|
+
*******
|
|
228
234
|
* Switch from ``edx-sphinx-theme`` to ``sphinx-book-theme`` since the former is
|
|
229
235
|
deprecated
|
|
236
|
+
* Add python 3.12 support
|
|
230
237
|
|
|
231
238
|
[0.4.1]
|
|
232
239
|
*******
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
edx_enterprise_subsidy_client/__init__.py,sha256=ohnfF6pu_QiBBqJuz8O3HJhED7cUdSsYU2qj5HDT0fI,205
|
|
2
|
+
edx_enterprise_subsidy_client/client.py,sha256=omt6lIVuGu4GtbYu45u5ghCKUzg-309EDpnGqldTWMw,13212
|
|
3
|
+
edx_enterprise_subsidy_client-0.4.3.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
4
|
+
edx_enterprise_subsidy_client-0.4.3.dist-info/LICENSE.txt,sha256=QTW2QN7q3XszgUAXm9Dzgtu5LXYKbR1SGnqMa7ufEuY,35139
|
|
5
|
+
edx_enterprise_subsidy_client-0.4.3.dist-info/METADATA,sha256=9QwvAwDzaH4HDoiSPyv30l8VfJADkUajv1qFGZ64Aeg,9585
|
|
6
|
+
edx_enterprise_subsidy_client-0.4.3.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
|
7
|
+
edx_enterprise_subsidy_client-0.4.3.dist-info/top_level.txt,sha256=X3PxOH44rjQXFaA8EX-ZpUEL4SjfMM_yUkS-KbvNIZk,30
|
|
8
|
+
edx_enterprise_subsidy_client-0.4.3.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
edx_enterprise_subsidy_client/__init__.py,sha256=Qago1ji3EXcw5_c2Kjq5XF2IkFbZqRuwci3kGut6Qt8,205
|
|
2
|
-
edx_enterprise_subsidy_client/client.py,sha256=56yVQkW6Mgbcm1qTYpJInBVMyIqG3QQSIm4q5MB1MHc,11836
|
|
3
|
-
edx_enterprise_subsidy_client-0.4.1.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
4
|
-
edx_enterprise_subsidy_client-0.4.1.dist-info/LICENSE.txt,sha256=QTW2QN7q3XszgUAXm9Dzgtu5LXYKbR1SGnqMa7ufEuY,35139
|
|
5
|
-
edx_enterprise_subsidy_client-0.4.1.dist-info/METADATA,sha256=Z36WHMQceViigljVvODv5LkpWqaLgkPcxKHiCOLmzsw,9453
|
|
6
|
-
edx_enterprise_subsidy_client-0.4.1.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
|
|
7
|
-
edx_enterprise_subsidy_client-0.4.1.dist-info/top_level.txt,sha256=X3PxOH44rjQXFaA8EX-ZpUEL4SjfMM_yUkS-KbvNIZk,30
|
|
8
|
-
edx_enterprise_subsidy_client-0.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|