.headless_export
class: ExportServer
- class ExportServer(**kwargs)[source]
- Class that provides methods for interacting with the Highcharts Export Server. - Note - By default, the - ExportServerclass operates using the Highcharts-provided export server. If you wish to use your own (or a custom) export server, you can configure the class using either the- url,- port, and- pathproperties explicitly or by setting the- HIGHCHARTS_EXPORT_SERVER_DOMAIN`, ``HIGHCHARTS_EXPORT_SERVER_PORT, or- HIGHCHARTS_EXPORT_SERVER_PATHenvironment variables.- Class Inheritance - copy(other=None, overwrite=True, **kwargs)
- Copy the configuration settings from this instance to the - otherinstance.- Parameters:
- other ( - HighchartsMeta) – The target instance to which the properties of this instance should be copied. If- None, will create a new instance and populate it with properties copied from- self. Defaults to- None.
- overwrite ( - bool) – if- True, properties in- otherthat are already set will be overwritten by their counterparts in- self. Defaults to- True.
- kwargs – Additional keyword arguments. Some special descendents of - HighchartsMetamay have special implementations of this method which rely on additional keyword arguments.
 
- Returns:
- A mutated version of - otherwith new property values
 
 - classmethod from_dict(as_dict: dict, allow_snake_case: bool = True)
- Construct an instance of the class from a - dictobject.
 - classmethod from_js_literal(as_str_or_file, allow_snake_case: bool = True, _break_loop_on_failure: bool = False)
- Return a Python object representation of a Highcharts JavaScript object literal. - Parameters:
- as_str_or_file ( - str) – The JavaScript object literal, represented either as a- stror as a filename which contains the JS object literal.
- allow_snake_case ( - bool) – If- True, interprets- snake_casekeys as equivalent to- camelCasekeys. Defaults to- True.
- _break_loop_on_failure ( - bool) – If- True, will break any looping operations in the event of a failure. Otherwise, will attempt to repair the failure. Defaults to- False.
 
- Returns:
- A Python object representation of the Highcharts JavaScript object literal. 
- Return type:
- HighchartsMeta
 
 - classmethod from_json(as_json_or_file, allow_snake_case: bool = True)
- Construct an instance of the class from a JSON string. - Parameters:
- as_json_or_file – The JSON string for the object or the filename of a file that contains the JSON string. 
- allow_snake_case ( - bool) – If- True, interprets- snake_casekeys as equivalent to- camelCasekeys. Defaults to- True.
 
- Returns:
- A Python objcet representation of - as_json.
- Return type:
- HighchartsMeta
 
 - classmethod get_chart(filename=None, auth_user=None, auth_password=None, timeout=0.5, **kwargs)[source]
- Produce an exported chart image. - Parameters:
- filename (Path-like or - None) – The name of the file where the exported chart should (optionally) be persisted. Defaults to- None.
- auth_user ( - stror- None) – The username to use to authenticate against the Export Server, using basic authentication. Defaults to- None.
- auth_password ( - stror- None) – The password to use to authenticate against the Export Server (using basic authentication). Defaults to- None.
- timeout (numeric or - None) – The number of seconds to wait before issuing a timeout error. The timeout check is passed if bytes have been received on the socket in less than the- timeoutvalue. Defaults to- 0.5.
 
 - Note - All other keyword arguments are as per the - ExportServerconstructor- ExportServer.__init__()
 - request_chart(filename=None, auth_user=None, auth_password=None, timeout=0.5, **kwargs)[source]
- Execute a request against the export server based on the configuration in the instance. - Parameters:
- filename (Path-like or - None) – The name of the file where the exported chart should (optionally) be persisted. Defaults to- None.
- auth_user ( - stror- None) – The username to use to authenticate against the Export Server, using basic authentication. Defaults to- None.
- auth_password ( - stror- None) – The password to use to authenticate against the Export Server (using basic authentication). Defaults to- None.
- timeout (numeric or - None) – The number of seconds to wait before issuing a timeout error. The timeout check is passed if bytes have been received on the socket in less than the- timeoutvalue. Defaults to- 0.5.
 
 - Note - All other keyword arguments are as per the - ExportServerconstructor- ExportServer.__init__()- Returns:
- The exported chart image, either as a - bytesbinary object or as a base-64 encoded string (depending on the- use_base64property).
- Return type:
 
 - to_dict() dict
- Generate a - dictrepresentation of the object compatible with the Highcharts JavaScript library.- Note - The - dictrepresentation has a property structure and naming convention that is intentionally consistent with the Highcharts JavaScript library. This is not Pythonic, but it makes managing the interplay between the two languages much, much simpler.
 - to_js_literal(filename=None, encoding='utf-8') str | None
- Return the object represented as a - strcontaining the JavaScript object literal.
 - to_json(filename=None, encoding='utf-8')
- Generate a JSON string/byte string representation of the object compatible with the Highcharts JavaScript library. - Note - This method will either return a standard - stror a- bytesobject depending on the JSON serialization library you are using. For example, if your environment has orjson, the result will be a- bytesrepresentation of the string.- Parameters:
- Returns:
- A JSON representation of the object compatible with the Highcharts library. 
- Return type:
 
 - static trim_dict(untrimmed: dict, to_json: bool = False) dict
- Remove keys from - untrimmedwhose values are- Noneand convert values that have- .to_dict()methods.
 - static trim_iterable(untrimmed, to_json=False)
- Convert any - EnforcedNullTypevalues in- untrimmedto- 'null'.
 - property async_rendering: bool
- If - True, will delay the (server-side) rendering of the exported chart until all scripts, functions, and event handlers provided have been executed and the (JavaScript) method- highexp.done()is called. Defaults to- False.- Return type:
 
 - property callback: CallbackFunction | None
- A JavaScript function to execute in the (JavaScript) Highcharts constructor. - Note - This setting is equivalent to providing the - Chart.callback()setting.- Return type:
- CallbackFunctionor- None
 
 - property constructor: str | None
- The (JavaScript) constructor to use when generating the exported chart. Defaults to - None.- Accepts: - 'Chart'
- 'Stock'
 
 - property custom_code: CallbackFunction | None
- When - data_optionsis not- None, this (JavaScript) callback function is executed after the data options are applied. The only argument it receives is the complete set of- HighchartsOptions(as a JS literal object), which will be passed to the Highcharts constructor on return. Defaults to- None.- Return type:
- CallbackFunctionor- None
 
 - property data_options: Data | None
- Configuration of data options to add data to the chart from sources like CSV. Defaults to - None.- Return type:
- Dataor- None
 
 - property domain: str | None
- The domain where the Export Server can be found. Defaults to the Highsoft-provided Export Server at - 'export.highcharts.com', unless over-ridden by the- HIGHCHARTS_EXPORT_SERVER_DOMAINenvironment variable.- Tip - This property is set automatically by the - HIGHCHARTS_EXPORT_SERVER_DOMAINenvironment variable, if present.- Warning - If set to - None, will fall back to the- HIGHCHARTS_EXPORT_SERVER_DOMAINvalue if available, and the Highsoft- provided server (- 'export.highcharts.com') if not.- Return type:
- str
 
 - property format_: str | None
- The format in which the exported chart should be returned. Defaults to - 'png'.- Accepts: - 'png'
- 'jpeg'
- 'pdf'
- 'svg'
 
 - property global_options: HighchartsOptions | None
- The global options which will be passed to the (JavaScript) - Highcharts.setOptions()method, and which will be applied to the exported chart. Defaults to- None.- Return type:
- HighchartsOptions
 
 - property no_download: bool
- If - True, will not send attachment headers in the HTTP response when exporting a chart. Defaults to- False.- Return type:
 
 - property options: HighchartsOptions | None
- The - HighchartsOptionswhich should be applied to render the exported chart. Defaults to- None.- Return type:
- HighchartsOptionsor- None
 
 - property path: str | None
- The path (at the - ExportServer.url()) where the Export Server can be reached. Defaults to- None(for the Highsoft-provided export server), unless over-ridden by the- HIGHCHARTS_EXPORT_SERVER_PATHenvironment variable.- Tip - This property is set automatically by the - HIGHCHARTS_EXPORT_SERVER_PATHenvironment variable, if present.- Warning - If set to - None, will fall back to the- HIGHCHARTS_EXPORT_SERVER_PATHvalue if available. If unavailable, will revert to- None.- Return type:
- str
 
 - property port: int | None
- The port on which the Export Server can be found. Defaults to - None(for the Highsoft-provided export server), unless over-ridden by the- HIGHCHARTS_EXPORT_SERVER_PORTenvironment variable.- Tip - This property is set automatically by the - HIGHCHARTS_EXPORT_SERVER_PORTenvironment variable, if present.- Warning - If set to - None, will fall back to the- HIGHCHARTS_EXPORT_SERVER_PORTvalue if available. If unavailable, will revert to- None.- Return type:
- str
 
 - property protocol: str | None
- The protocol over which the Highcharts for Python library should communicate with the Export Server. Accepts either - 'https'or- 'http'. Defaults to the- HIGHCHARTS_EXPORT_SERVER_PROTOCOLenvironment variable if present, otherwise falls back to default of- 'https'.- Tip - This property is set automatically by the - HIGHCHARTS_EXPORT_SERVER_PROTOCOLenvironment variable, if present.- Warning - If set to - None, will fall back to the- HIGHCHARTS_EXPORT_SERVER_PROTOCOLvalue if available, and the Highsoft- provided server (- 'export.highcharts.com') if not.- Return type:
 
 - property scale: int | float | None
- The scale factor by which the exported chart image should be scaled. Defaults to - 1.- Tip - Use this setting to improve resolution when exporting PNG or JPEG images. For example, setting - .scale = 2on a chart whose width is 600px will produce an image with a width of 1200px.- Warning - If - widthis explicitly set, this setting will be overridden.- Return type:
- numeric 
 
 - property url: str | None
- The fully-formed URL for the Export Server, consisting of a - protocol, a- domain, and optional- portand- path.- Note - If explicitly set, will override the values in related properties: - Return type: