vc-utils 3.0__tar.gz → 3.2__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.
- {vc_utils-3.0 → vc_utils-3.2}/PKG-INFO +1 -1
- {vc_utils-3.0 → vc_utils-3.2}/linkage/achievement.py +2 -2
- {vc_utils-3.0 → vc_utils-3.2}/linkage/session.py +26 -3
- {vc_utils-3.0 → vc_utils-3.2}/setup.py +1 -1
- {vc_utils-3.0 → vc_utils-3.2}/vc_utils.egg-info/PKG-INFO +1 -1
- {vc_utils-3.0 → vc_utils-3.2}/README.md +0 -0
- {vc_utils-3.0 → vc_utils-3.2}/linkage/__init__.py +0 -0
- {vc_utils-3.0 → vc_utils-3.2}/linkage/key_generator.py +0 -0
- {vc_utils-3.0 → vc_utils-3.2}/setup.cfg +0 -0
- {vc_utils-3.0 → vc_utils-3.2}/vc_utils.egg-info/SOURCES.txt +0 -0
- {vc_utils-3.0 → vc_utils-3.2}/vc_utils.egg-info/dependency_links.txt +0 -0
- {vc_utils-3.0 → vc_utils-3.2}/vc_utils.egg-info/requires.txt +0 -0
- {vc_utils-3.0 → vc_utils-3.2}/vc_utils.egg-info/top_level.txt +0 -0
|
@@ -105,6 +105,18 @@ class Linkage_Application:
|
|
|
105
105
|
|
|
106
106
|
# then invoke the post request with the token
|
|
107
107
|
return await session.post(url, **kwargs)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
async def linkage_patch(self, session, url, **kwargs):
|
|
111
|
+
if not self.token:
|
|
112
|
+
self.token = await application_get_token()
|
|
113
|
+
|
|
114
|
+
headers = kwargs.get("headers", {})
|
|
115
|
+
headers["Authorization"] = f"Bearer {self.token}"
|
|
116
|
+
kwargs["headers"] = headers
|
|
117
|
+
|
|
118
|
+
# then invoke the patch request with the token
|
|
119
|
+
return await session.patch(url, **kwargs)
|
|
108
120
|
|
|
109
121
|
|
|
110
122
|
async def get_user_data(self, session, user_id, spec_id, download_url_expiration=3600):
|
|
@@ -129,6 +141,15 @@ class Linkage_Application:
|
|
|
129
141
|
return await resp.json()
|
|
130
142
|
|
|
131
143
|
|
|
144
|
+
async def request_review_user_data(self, session, user_id, spec_id):
|
|
145
|
+
uri = f"{LINKAGE_M2M_HOST}/data/user/{user_id}/spec/{spec_id}"
|
|
146
|
+
resp = await self.linkage_patch(session, uri)
|
|
147
|
+
if resp.status != 200:
|
|
148
|
+
error_data = await resp.json()
|
|
149
|
+
raise Exception(error_data)
|
|
150
|
+
return await resp.json()
|
|
151
|
+
|
|
152
|
+
|
|
132
153
|
async def update_achievement(self, session, user_id, achievement):
|
|
133
154
|
"""
|
|
134
155
|
POST /achievements/user/{user_id}
|
|
@@ -141,8 +162,10 @@ class Linkage_Application:
|
|
|
141
162
|
opened_files = []
|
|
142
163
|
try:
|
|
143
164
|
data = aiohttp.FormData()
|
|
144
|
-
|
|
145
|
-
|
|
165
|
+
if achievement.title is not None:
|
|
166
|
+
data.add_field("title", achievement.title)
|
|
167
|
+
if achievement.description is not None:
|
|
168
|
+
data.add_field("description", achievement.description)
|
|
146
169
|
if achievement.metadata is not None:
|
|
147
170
|
data.add_field("metadata", str(achievement.metadata))
|
|
148
171
|
if achievement.files:
|
|
@@ -220,7 +243,7 @@ async def get_user_data(token, spec_id=None):
|
|
|
220
243
|
}
|
|
221
244
|
async with aiohttp.ClientSession() as session:
|
|
222
245
|
if spec_id is not None:
|
|
223
|
-
async with session.get(f"{LINKAGE_U2M_HOST}/data/{spec_id}", headers=headers) as resp:
|
|
246
|
+
async with session.get(f"{LINKAGE_U2M_HOST}/data/{spec_id}?auto_request=true", headers=headers) as resp:
|
|
224
247
|
if resp.status != 200:
|
|
225
248
|
error_data = await resp.json()
|
|
226
249
|
raise Exception(error_data)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|