Skip to content

Commit 73f6139

Browse files
committed
Implemented Exporting.fetch_options property.
1 parent 8e18139 commit 73f6139

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

highcharts_core/options/exporting/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def __init__(self, **kwargs):
7878
self._enabled = None
7979
self._error = None
8080
self._fallback_to_export_server = None
81+
self._fetch_options = None
8182
self._filename = None
8283
self._form_attributes = None
8384
self._lib_url = None
@@ -104,6 +105,7 @@ def __init__(self, **kwargs):
104105
self.enabled = kwargs.get('enabled', None)
105106
self.error = kwargs.get('error', None)
106107
self.fallback_to_export_server = kwargs.get('fallback_to_export_server', None)
108+
self.fetch_options = kwargs.get('fetch_options', None)
107109
self.filename = kwargs.get('filename', None)
108110
self.form_attributes = kwargs.get('form_attributes', None)
109111
self.lib_url = kwargs.get('lib_url', None)
@@ -339,6 +341,24 @@ def fallback_to_export_server(self, value):
339341
else:
340342
self._fallback_to_export_server = bool(value)
341343

344+
@property
345+
def fetch_options(self) -> Optional[dict]:
346+
"""Options for the fetch request used when sending the SVG to the export server.
347+
Defaults to :obj:`None <python:None>`.
348+
349+
.. seealso::
350+
351+
* `MDN: Fetch <https://developer.mozilla.org/en-US/docs/Web/API/fetch>`__ for more information
352+
353+
:returns: The options for the fetch request, expressed as a Python :class:`dict <python:dict>`
354+
:rtype: :class:`dict <python:dict>` or :obj:`None <python:None>`
355+
"""
356+
return self._fetch_options
357+
358+
@fetch_options.setter
359+
def fetch_options(self, value):
360+
self._fetch_options = validators.dict(value, allow_empty = True)
361+
342362
@property
343363
def filename(self) -> Optional[str]:
344364
"""The filename (without file type extension) to use for the exported chart.
@@ -717,6 +737,7 @@ def _get_kwargs_from_dict(cls, as_dict):
717737
'enabled': as_dict.get('enabled', None),
718738
'error': as_dict.get('error', None),
719739
'fallback_to_export_server': as_dict.get('fallbackToExportServer', None),
740+
'fetch_options': as_dict.get('fetchOptions', None),
720741
'filename': as_dict.get('filename', None),
721742
'form_attributes': as_dict.get('formAttributes', None),
722743
'lib_url': as_dict.get('libURL', None),
@@ -748,6 +769,7 @@ def _to_untrimmed_dict(self, in_cls = None) -> dict:
748769
'enabled': self.enabled,
749770
'error': self.error,
750771
'fallbackToExportServer': self.fallback_to_export_server,
772+
'fetchOptions': self.fetch_options,
751773
'filename': self.filename,
752774
'formAttributes': self.form_attributes,
753775
'libURL': self.lib_url,

0 commit comments

Comments
 (0)