Wiki#
For usage information and examples, see Wikis
- class dataikuapi.dss.wiki.DSSWiki(client, project_key)#
A handle to manage the wiki of a project
Important
Do not instantiate this class directly, instead use
dataikuapi.dss.project.DSSProject.get_wiki()
- get_settings()#
Get wiki settings
- Returns:
a handle to manage the wiki settings (taxonomy, home article)
- Return type:
- get_article(article_id_or_name)#
Get a wiki article
- Parameters:
article_id_or_name (str) – reference to the article, it can be its ID or its name
- Returns:
a handle to manage the Article
- Return type:
- list_articles()#
Get a list of all the articles in form of
dataikuapi.dss.wiki.DSSWikiArticle
objects- Returns:
list of articles
- Return type:
- create_article(article_name, parent_id=None, content=None)#
Create a wiki article and return a handle to interact with it.
- Parameters:
article_name (str) – the article name
parent_id (str) – the parent article ID (or None if the article has to be at root level, defaults to None)
content (str) – the article content (defaults to None)
- Returns:
the created article
- Return type:
- get_export_stream(paper_size='A4', export_attachment=False)#
Download the whole wiki of the project in PDF format as a binary stream.
Warning
You need to close the stream after download. Failure to do so will result in the DSSClient becoming unusable.
- Parameters:
paper_size (str) – the format of the exported page, can be one of ‘A4’, ‘A3’, ‘US_LETTER’ or ‘LEDGER’ (defaults to A4)
export_attachment (bool) – export the attachments of the article(s) in addition to the pdf in a zip file (defaults to False)
- Returns:
the exported pdf or zip file as a stream
- export_to_file(path, paper_size='A4', export_attachment=False)#
Download the whole wiki of the project in PDF format into the given output file.
- Parameters:
path (str) – the path of the file where the pdf or zip file will be downloaded
paper_size (str) – the format of the exported page, can be one of ‘A4’, ‘A3’, ‘US_LETTER’ or ‘LEDGER’ (defaults to A4)
export_attachment (bool) – export the attachments of the article(s) in addition to the pdf in a zip file (defaults to False)
- class dataikuapi.dss.wiki.DSSWikiSettings(client, project_key, settings)#
Global settings for the wiki, including taxonomy. Call save() to save
- get_taxonomy()#
Get the taxonomy. The taxonomy is an array listing at top level the root article IDs and their children in a tree format. Every existing article of the wiki has to be in the taxonomy once and only once. For instance:
[ { 'id': 'article1', 'children': [] }, { 'id': 'article2', 'children': [ { 'id': 'article3', 'children': [] } ] } ]
Note
Note that this is a direct reference, not a copy, so modifications to the returned object will be reflected when saving
- Returns:
The taxonomy
- Return type:
list
- move_article_in_taxonomy(article_id, parent_article_id=None)#
An helper to update the taxonomy by moving an article with its children as a child of another article
- Parameters:
article_id (str) – the main article ID
parent_article_id (str) – the new parent article ID or None for root level (defaults to None)
- set_taxonomy(taxonomy)#
Set the taxonomy
- Parameters:
taxonomy (list) – the taxonomy
- get_home_article_id()#
Get the home article ID
- Returns:
The home article ID
- Return type:
str
- set_home_article_id(home_article_id)#
Set the home article ID
- Parameters:
home_article_id (str) – the home article ID
- save()#
Save the current settings to the backend
- class dataikuapi.dss.wiki.DSSWikiArticle(client, project_key, article_id_or_name)#
A handle to manage an article
- get_data()#
Get article data handle
- Returns:
the article data handle
- Return type:
- upload_attachement(fp, filename)#
Upload and attach a file to the article.
Note
Note that the type of file will be determined by the filename extension
- Parameters:
fp (file) – A file-like object that represents the upload file
filename (str) – The attachement filename
- get_uploaded_file(upload_id)#
Download an attachment of the article
Warning
You need to close the stream after download. Failure to do so will result in the DSSClient becoming unusable.
- Parameters:
upload_id (str) – The attachement upload id
- Returns:
The attachment file as a stream
- Return type:
requests.Response
- get_export_stream(paper_size='A4', export_children=False, export_attachment=False)#
Download the article in PDF format as a binary stream.
Warning
You need to close the stream after download. Failure to do so will result in the DSSClient becoming unusable.
- Parameters:
paper_size (str) – the format of the exported page, can be one of ‘A4’, ‘A3’, ‘US_LETTER’ or ‘LEDGER’ (defaults to A4)
export_children (bool) – export the children of the article in the pdf (defaults to False)
export_attachment (bool) – export the attachments of the article(s) in addition to the pdf in a zip file (defaults to False)
- Returns:
the exported pdf or zip file as a stream
- Return type:
requests.Response
- export_to_file(path, paper_size='A4', export_children=False, export_attachment=False)#
Download the article in PDF format into the given output file.
- Parameters:
path (str) – the path of the file where the pdf or zip file will be downloaded
paper_size (str) – the format of the exported page, can be one of ‘A4’, ‘A3’, ‘US_LETTER’ or ‘LEDGER’ (defaults to A4)
export_children (bool) – export the children of the article in the pdf (defaults to False)
export_attachment (bool) – export the attachments of the article(s) in addition to the pdf in a zip file (defaults to False)
- delete()#
Delete the article
- get_object_discussions()#
Get a handle to manage discussions on the article
- Returns:
the handle to manage discussions
- Return type:
dataikuapi.dss.wiki.DSSObjectDiscussions
- class dataikuapi.dss.wiki.DSSWikiArticleData(client, project_key, article_id, article_data)#
A handle to manage an article
- get_body()#
Get the markdown body as string
- Returns:
the article body
- Return type:
str
- set_body(content)#
Set the markdown body
- Parameters:
content (str) – the article content
- get_metadata()#
Get the article and attachment metadata
Note
Note that this is a direct reference, not a copy, so modifications to the returned object will be reflected when saving
- Returns:
the article metadata
- Return type:
dict
- set_metadata(metadata)#
Set the article metadata
- Parameters:
metadata (dict) – the article metadata
- get_name()#
Get the article name
- Returns:
the article name
- Return type:
str
- set_name(name)#
Set the article name
- Parameters:
name (str) – the article name
- save()#
Save the current article data to the backend.