API reference¶
- class richviewsdk.RichViewSession(token: str)¶
Bases:
objectA class used to represent a RichView Session.
Attributes¶
- headersdict
a dictionary containing the access token
- tokenstr
the access token for the session
Methods¶
- _get(url_ending)
Sends a GET request to the specified URL.
- _post(url_ending, body)
Sends a POST request to the specified URL with the provided body.
- _delete(url_ending)
Sends a DELETE request to the specified URL.
- _put(url_ending, body)
Sends a PUT request to the specified URL with the provided body.
- authenticate_with_password(email, password)
Authenticates the user with the provided email and password.
- get_reports()
Retrieves all the RichView reports in the user’s account.
- get_report(report_id)
Retrieves a specific report using its ID.
- create_report(report)
Creates a new report.
- delete_report(report_id)
Deletes a specific report using its ID.
- classmethod authenticate_with_password(email: str, password: str) RichViewSession¶
- get_reports() list¶
- get_report(report_id) RichViewReport¶
- create_report(report: RichViewReport) RichViewReport¶
- delete_report(report_id) bool¶
- class richviewsdk.RichViewBlock(report_id: str, type: str, data: dict, session: RichViewSession, id: str = None)¶
Bases:
objectA class used to represent a RichView Block.
Attributes¶
- report_idstr
the ID of the report the block belongs to
- block_idstr
the ID of the block
- block_typestr
the type of the block (e.g., ‘chart’, ‘image’, ‘header’, etc.)
- datadict
the data contained in the block
- sessionRichViewSession
the session the block belongs to
- synced_with_serverbool
a flag indicating whether the block is synced with the server
Methods¶
- update_block(**kwargs)
Updates the block with the provided keyword arguments.
- update_online_version()
Updates the online version of the block.
- get_online_version()
Retrieves the online version of the block.
- _asdict(assign_id=True)
Returns a dictionary representation of the block.
- update_block(**kwargs)¶
- update_online_version()¶
- get_online_version() RichViewBlock¶
- class richviewsdk.ChartBlock(report_id: str, chartOptions: str, session: RichViewSession, id: str = None, **kwargs)¶
Bases:
RichViewBlockA class used to represent a Chart Block.
Parameters¶
- chart_options_dictdict
a dictionary containing the chart options
- titlestr
the title of the chart
Methods¶
- get_data()
Retrieves the data of the chart.
- set_data(df)
Sets the data of the chart.
- set_title(title)
Sets the title of the chart.
- get_options()
Retrieves the chart options.
- update_options(force=False, **kwargs)
Updates the chart options.
- class ChartBlockData(chartOptions)¶
Bases:
dataobject– Create class ChartBlockData instance
- chartOptions¶
- get_data() DataFrame¶
- static convert_array_columns(df, array_columns)¶
- static check_for_array_columns(df)¶
- set_data(df: DataFrame) ChartBlock¶
- set_title(title: str) ChartBlock¶
- get_options() dict¶
- update_options(force: bool = False, **kwargs) ChartBlock¶
update_options _summary_
- Args:
force (bool, optional): Allows for creation of new properties. Defaults to False. kwargs: chart options to update
- Raises:
Exception: _description_
- Returns:
_type_: _description_
- class richviewsdk.ImageBlock(report_id: str, file: str, withBorder: bool, stretched: bool, withBackground: bool, session: RichViewSession, caption: str = '', id: str = None)¶
Bases:
RichViewBlockA class used to represent an Image Block.
Parameters¶
- report_idstr
The ID of the report the image block belongs to
- filestr
The file of the image block
- withBorderbool
A flag indicating whether the image block has a border
- stretchedbool
A flag indicating whether the image block is stretched
- withBackgroundbool
A flag indicating whether the image block has a background
- sessionRichViewSession
The session the image block belongs to
- captionstr, optional
The caption of the image block (default is ‘’)
- idstr, optional
The ID of the image block (default is None)
Methods¶
- __repr__()
Returns a string representation of the image block
- class richviewsdk.HeaderBlock(report_id: str, text: str, level: int, session: RichViewSession, id: str = None)¶
Bases:
RichViewBlock- class HeaderBlockData(text, level)¶
Bases:
dataobjectA class used to represent a Header Block. Parameters ———- report_id : str
The ID of the report the header block belongs to
- textstr
The text of the header block
- levelint
The level of the header block
- sessionRichViewSession
The session the header block belongs to
- idstr, optional
The ID of the header block (default is None)
Methods¶
- __repr__()
Returns a string representation of the header block
- level¶
- text¶
- class richviewsdk.ParagraphBlock(report_id: str, text: str, session: RichViewSession, id: str = None)¶
Bases:
RichViewBlockA class used to represent a Paragraph Block. Parameters ———- report_id : str
The ID of the report the paragraph block belongs to
- textstr
The text of the paragraph block
- sessionRichViewSession
The session the paragraph block belongs to
- idstr, optional
The ID of the paragraph block (default is None)
Methods¶
- __repr__()
Returns a string representation of the paragraph block
- class richviewsdk.EmbedBlock(report_id: str, service: str, source: str, embed: str, width: int, height: int, session: RichViewSession, caption: str = '', id: str = None)¶
Bases:
RichViewBlockA class used to represent an Embed Block.
Parameters¶
- report_idstr
The ID of the report the embed block belongs to
- servicestr
The service of the embed block
- sourcestr
The source of the embed block
- embedstr
The embed of the embed block
- widthint
The width of the embed block
- heightint
The height of the embed block
- sessionRichViewSession
The session the embed block belongs to
- captionstr, optional
The caption of the embed block (default is ‘’)
- idstr, optional
The ID of the embed block (default is None)
Methods¶
- __repr__()
Returns a string representation of the embed block
- class richviewsdk.TableBlock(report_id: str, content: list, withHeadings: bool, session: RichViewSession, id: str = None)¶
Bases:
RichViewBlockA class used to represent a Table Block.
Methods¶
- __repr__()
Returns a string representation of the table block
- class richviewsdk.CodeBlock(report_id: str, code: str, language: str, showlinenumbers: bool, session: RichViewSession, id: str = None)¶
Bases:
RichViewBlockA class used to represent a Code Block.
Parameters¶
- report_idstr
The ID of the report the code block belongs to
- codestr
The code of the code block
- languagestr
The language of the code block
- showlinenumbersbool
A flag indicating whether the code block shows line numbers
- sessionRichViewSession
The session the code block belongs to
- idstr, optional
The ID of the code block (default is None)
Methods¶
- __repr__()
Returns a string representation of the code block
- class richviewsdk.ListBlock(report_id: str, style: str, items: list, session: RichViewSession, id: str = None)¶
Bases:
RichViewBlockA class used to represent a List Block.
Parameters¶
- report_idstr
The ID of the report the list block belongs to
- stylestr
The style of the list block
- itemslist
The items of the list block
- sessionRichViewSession
The session the list block belongs to
- idstr, optional
The ID of the list block (default is None)
Methods¶
- __repr__()
Returns a string representation of the list block
- class richviewsdk.RichViewReport(title: str, blocks: list, session: RichViewSession, id: str = None, lastEdited: str = None, **kwargs)¶
Bases:
objectA class used to represent a RichView Report.
Attributes¶
- titlestr
the title of the report
- sessionRichViewSession
the session the report belongs to
- synced_with_serverbool
a flag indicating whether the report is synced with the server
- lastEditedstr
the last edited timestamp of the report
- report_idstr
the ID of the report
- blockslist
a list of blocks in the report
Methods¶
- duplicate()
Duplicates the report.
- send(email_receiving_editor)
Sends the report to the specified email.
- query(type, data)
Queries the report for blocks of a specific type and data.
- set_title(title)
Sets the title of the report.
- get_charts()
Retrieves all the charts in the report.
- get_chart(chart_id)
Retrieves a specific chart using its ID.
- get_block(block_id)
Retrieves a specific block using its ID.
- get_blocks()
Retrieves all the blocks in the report.
- add_block(block)
Adds a block to the report.
- delete_block(block_id)
Deletes a specific block using its ID.
- update_online_version()
Updates the online version of the report.
- get_online_version()
Retrieves the online version of the report.
- duplicate() RichViewReport¶
- send(email_receiving_editor: str) bool¶
- query(type: str, data: str) List[RichViewBlock]¶
- set_title(title: str) RichViewReport¶
- get_charts() List[ChartBlock]¶
- get_chart(chart_id: str) ChartBlock¶
- get_block(block_id: str) RichViewBlock¶
- get_blocks() List[RichViewBlock]¶
- add_block(block: RichViewBlock) RichViewBlock¶
- delete_block(block_id: str) RichViewReport¶
- update_online_version() RichViewReport¶
- get_online_version() RichViewReport¶
- richviewsdk.check_if_all_properties_exist(nested_dict, reference_dict)¶