Mentions légales du service

Skip to content
Snippets Groups Projects
Commit aa3310e7 authored by ANDRADE-BARROSO Guillermo's avatar ANDRADE-BARROSO Guillermo
Browse files

fixes on get_project_data and get_projects_data

parent e60ff0a7
Branches
No related tags found
1 merge request!49update implementation to be compatible with overleaf version 5.2.1
Pipeline #1225087 failed
......@@ -736,12 +736,10 @@ class SyncClient:
storage = threading.local()
storage.is_data = False
class _Namespace(LoggingNamespace):
def on_event(self, event, *args):
print('HOHOHO', event, args)
storage.project_data = args[0]["project"]
storage.is_data = True
def on_joint_project(*args):
logger.debug("[socketIO] join project ok")
storage.project_data = args[0]["project"]
storage.is_data = True
headers = {"Referer": url}
headers.update(self.headers)
......@@ -749,10 +747,11 @@ class SyncClient:
self.base_url,
params={"projectId": project_id},
verify=self.verify,
Namespace=_Namespace,
Namespace=LoggingNamespace,
cookies=self.cookie,
headers=headers,
) as socketIO:
socketIO.on("joinProjectResponse", on_joint_project)
while not storage.is_data:
logger.debug("[socketIO] wait for project data")
socketIO.wait(0.1)
......@@ -794,7 +793,11 @@ class SyncClient:
r = self._get(url=f"{self.base_url}/project/", verify=self.verify)
parsed = html.fromstring(r.content)
elements = parsed.xpath("//meta[@name='ol-projects']")
return list(json.loads(elements[0].get("content")))
if elements:
return list(json.loads(elements[0].get("content")))
else:
elements = parsed.xpath("//meta[@name='ol-prefetchedProjectsBlob']")
return json.loads(elements[0].get("content"))["projects"]
def get_project_update_data(self, project_id: str) -> UpdateDatum:
"""Get update (history) data of a project.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment