API Reference#
- class overlincs_git.SyncClient(*, base_url: str = 'https://overleaf.irisa.fr', username: str = '', password: str = '', verify: bool = True, authenticator: Authenticator | None = None)[source]#
Bases:
object
Sync client
- check_or_create_folder(metadata: ProjectData, folder_path: str) str [source]#
Check if a given folder exists on sharelatex side.
Create it recursively if needed and return its id. It looks in the metadata and create the missing directories. Make sure the metadata are up-to-date when calling this.
- compile(project_id: str) Any [source]#
Trigger a remote compilation.
Note that this is run against the remote version not the local one.
- Parameters:
project_id (str) – The project id of the project to compile
- Returns:
response (dict) status of the request as returned by sharelatex
- Raises:
Exception if something is wrong with the compilation –
- create_folder(project_id: str, parent_folder: str, name: str) Any [source]#
Create a folder on sharelatex.
- Parameters:
- Returns:
response (dict) status of the request as returned by sharelatex
- Raises:
Something wrong with sharelatex –
- 500 server error –
- 400 the folder already exists –
- delete(project_id: str, *, forever: bool = False) Any [source]#
Delete a project for the current user.
- Parameters:
project_id (str) – The project id of the project to delete
- delete_document(project_id: str, doc_id: str) Response [source]#
Delete a single document (e.g tex file).
- delete_folder(project_id: str, folder_id: str) Response [source]#
Delete a single folder (with all data inside).
- download_project(project_id: str, *, path: str = '.', keep_zip: bool = False) None [source]#
Download and unzip the project.
Beware that this will overwrite any existing project file under path.
- Parameters:
project_id (str) – The id of the project to download
path (Path) – A valid path where the files will be saved
- Raises:
Exception if the project can't be downloaded/unzipped. –
- get_chats_messages(project_id: str) Any [source]#
Get a list of messages in chat channel of a project.
- Parameters:
project_id (str) – The id of the project that have chat messages
- Raises:
Exception if the get failed –
- Returns:
such content, timestamp of posted message, poster(user) information dictionary
- Return type:
a list of dictionaries contains messages information
- get_document(project_id: str, doc_id: str, dest_path: str | None = None) bool | str [source]#
Get a document from a project .
This mimics the browser behavior when opening the project editor. This will open a websocket connection to the server to get the information.
- Parameters:
- Returns:
A string corresponding to the document if dest_path is None or True if dest_path is correctly written
- get_file(project_id: str, file_id: str, dest_path: str | None = None) str | bool [source]#
Get an individual file (e.g image).
- Parameters:
- Returns:
A string corresponding to the file if dest_path is None or True if dest_path is correctly written
- Raises:
Exception if the file can't be downloaded –
- get_project_data(project_id: str) ProjectData [source]#
Get the project hierarchy and some metadata.
This mimics the browser behaviour when opening the project editor. This will open a websocket connection to the server to get the information.
- Parameters:
project_id (str) – The id of the project
- get_project_update_data(project_id: str) UpdateDatum [source]#
Get update (history) data of a project.
- Parameters:
project_id (str) – The id of the project to download
- Raises:
Exception if the project update data can't be downloaded. –
- get_projects_data() list [source]#
Get list of projects data. Every element of return list is a dictionary of some data of a project
- new(project_name: str, template: str = 'example') Any [source]#
Create a new example project for the current user.
- post_chat_message(project_id: str, message: str) bool [source]#
Post a message in chat channel of a project.
Send an invitation to share (edit/view) a project.
- Parameters:
- Returns:
response (dict) status of the request as returned by sharelatex
- Raises:
Exception if something is wrong with the compilation –
- update_project_settings(project_id: str, **settings: Any) Response [source]#
Update the project settings.
Update the project settings.
- Parameters:
project_id (str) – The project id
settings – the key/value of the settings to change (as keyword arguments)
Examples:
client.update_project_settings("5f326e4150cb80007f99a7c0", compiler="xelatex", name="newname")
Returns
The request response.
- upload(path: str) Any [source]#
Upload a project (zip) to sharelatex.
- Parameters:
path (str) – Path to the zip file of a project.
- Returns:
response (dict) status of the request as returned by sharelatex
- Raises:
Exception if something is wrong with the zip of the upload. –