weasyprint API Reference
HTML/CSS-to-PDF renderer for converting Odoo web document templates into high-fidelity printable submittals.
weasyprint.Attachment
Python Library Documentation: class Attachment in module weasyprint class Attachment(builtins.object) | Attachment(guess=None, filename=None, url=None, file_obj=None, string=None, base_url=None, url_fetcher=None, name=None, description=None, created=None, modified=None, relationship='Unspecified') | | File attachment for a PDF document. | | An instance is created in the same way as :class:`HTML`, except that the | HTML specific arguments (``encoding`` and ``media_type``) are not | supported. | | :param str name: | The name of the attachment to be included in the PDF document. | May be :obj:`None`. | :param str description: | A description of the attachment to be included in the PDF document. | May be :obj:`None`. | :type created: :obj:`datetime.datetime` | :param created: | Creation date and time. Default is current date and time. | :type modified: :obj:`datetime.datetime` | :param modified: | Modification date and time. Default is current date and time. | :param str relationship: | A string that represents the relationship between the attachment and | the PDF it is embedded in. Default is 'Unspecified', other common | values are defined in ISO-32000-2:2020, 7.11.3. | | Methods defined here: | | __init__(self, guess=None, filename=None, url=None, file_obj=None, string=None, base_url=None, url_fetcher=None, name=None, description=None, created=None, modified=None, relationship='Unspecified') | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
weasyprint.CSS
Python Library Documentation: class CSS in module weasyprint class CSS(builtins.object) | CSS(guess=None, filename=None, url=None, file_obj=None, string=None, encoding=None, base_url=None, url_fetcher=None, _check_mime_type=False, media_type='print', font_config=None, counter_style=None, color_profiles=None, matcher=None, page_rules=None, layers=None, layer=None) | | CSS stylesheet parsed by tinycss2. | | An instance is created in the same way as :class:`HTML`, with the same | arguments. | | An additional argument called ``font_config`` must be provided to handle | ``@font-face`` rules. The same ``text.fonts.FontConfiguration`` object | must be used for different ``CSS`` objects applied to the same document. | | ``CSS`` objects have no public attributes or methods. They are only meant | to be used in the :meth:`HTML.write_pdf` and :meth:`HTML.render` methods | of :class:`HTML` objects. | | Methods defined here: | | __init__(self, guess=None, filename=None, url=None, file_obj=None, string=None, encoding=None, base_url=None, url_fetcher=None, _check_mime_type=False, media_type='print', font_config=None, counter_style=None, color_profiles=None, matcher=None, page_rules=None, layers=None, layer=None) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
weasyprint.DEFAULT_OPTIONS
Python Library Documentation: dict object
class dict(object)
| dict() -> new empty dictionary
| dict(mapping) -> new dictionary initialized from a mapping object's
| (key, value) pairs
| dict(iterable) -> new dictionary initialized as if via:
| d = {}
| for k, v in iterable:
| d[k] = v
| dict(**kwargs) -> new dictionary initialized with the name=value pairs
| in the keyword argument list. For example: dict(one=1, two=2)
|
| Built-in subclasses:
| StgDict
|
| Methods defined here:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
weasyprint.Document
Python Library Documentation: class Document in module weasyprint.document
class Document(builtins.object)
| Document(pages, metadata, url_fetcher, font_config, color_profiles, output_intent)
|
| A rendered document ready to be painted in a pydyf stream.
|
| Typically obtained from :meth:`HTML.render() <weasyprint.HTML.render>`, but
| can also be instantiated directly with a list of :class:`pages <Page>`, a
| set of :class:`metadata <DocumentMetadata>`, a :class:`url_fetcher
| <weasyprint.urls.URLFetcher>`, and a :class:`font_config
| <weasyprint.text.fonts.FontConfiguration>`.
|
| Methods defined here:
|
| __init__(self, pages, metadata, url_fetcher, font_config, color_profiles, output_intent)
| Initialize self. See help(type(self)) for accurate signature.
|
| copy(self, pages='all')
| Take a subset of the pages.
|
| :type pages: :term:`iterable`
| :param pages:
| An iterable of :class:`Page` objects from :attr:`pages`.
| :return:
| A new :class:`Document` object.
|
| Examples:
|
| Write two PDF files for odd-numbered and even-numbered pages::
|
| # Python lists count from 0 but pages are numbered from 1.
| # [::2] is a slice of even list indexes but odd-numbered pages.
| document.copy(document.pages[::2]).write_pdf('odd_pages.pdf')
| document.copy(document.pages[1::2]).write_pdf('even_pages.pdf')
|
| Combine multiple documents into one PDF file,
| using metadata from the first::
|
| all_pages = [p for doc in documents for p in doc.pages]
| documents[0].copy(all_pages).write_pdf('combined.pdf')
|
| make_bookmark_tree(self, scale=1, transform_pages=False)
| Make a tree of all bookmarks in the document.
|
| :param float scale:
| Zoom scale.
| :param bool transform_pages:
| A boolean defining whether the default PDF page transformation
| matrix has to be applied to bookmark coordinates, setting the
| bottom-left corner as the origin.
| :return: A list of bookmark subtrees.
| A subtree is ``(label, target, children, state)``. ``label`` is
| a string, ``target`` is ``(page_number, x, y)`` and ``children``
| is a list of child subtrees.
|
| write_pdf(self, target=None, zoom=1, finisher=None, **options)
| Paint the pages in a PDF file, with metadata.
|
| :type target:
| :class:`str`, :class:`pathlib.Path` or :term:`file object`
| :param target:
| A filename where the PDF file is generated, a file object, or
| :obj:`None`.
| :param float zoom:
| The zoom factor in PDF units per CSS units. **Warning**:
| All CSS units are affected, including physical units like
| ``cm`` and named sizes like ``A4``. For values other than
| 1, the physical CSS units will thus be "wrong".
| :type finisher: :term:`callable`
| :param finisher:
| A finisher function or callable that accepts the document and a
| :class:`pydyf.PDF` object as parameters. Can be passed to perform
| post-processing on the PDF right before the trailer is written.
| :param options:
| The ``options`` parameter includes by default the
| :data:`weasyprint.DEFAULT_OPTIONS` values.
| :returns:
| The PDF as :obj:`bytes` if ``target`` is not provided or
| :obj:`None`, otherwise :obj:`None` (the PDF is written to
| ``target``).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
weasyprint.HTML
Python Library Documentation: class HTML in module weasyprint class HTML(builtins.object) | HTML(guess=None, filename=None, url=None, file_obj=None, string=None, encoding=None, base_url=None, url_fetcher=None, media_type='print') | | HTML document parsed by tinyhtml5. | | You can just create an instance with a positional argument: | ``doc = HTML(something)`` | The class will try to guess if the input is a filename, an absolute URL, | or a :term:`file object`. | | Alternatively, use **one** named argument so that no guessing is involved: | | :type filename: str or pathlib.Path | :param filename: | A filename, relative to the current directory, or absolute. | :param str url: | An absolute, fully qualified URL. | :type file_obj: :term:`file object` | :param file_obj: | Any object with a ``read`` method. | :param str string: | A string of HTML source. | | Specifying multiple inputs is an error: | ``HTML(filename="foo.html", url="localhost://bar.html")`` | will raise a :obj:`TypeError`. | | You can also pass optional named arguments: | | :param str encoding: | Force the source character encoding. | :type base_url: str or pathlib.Path | :param base_url: | The base used to resolve relative URLs (e.g. in | ``<img src="../foo.png">``). If not provided, try to use the input | filename, URL, or ``name`` attribute of | :term:`file objects <file object>`. | :type url_fetcher: :term:`callable` | :param url_fetcher: | An instance of :class:`urls.URLFetcher`. (See :ref:`URL Fetchers`.) | :param str media_type: | The media type to use for ``@media``. Defaults to ``'print'``. | **Note:** In some cases like ``HTML(string=foo)`` relative URLs will be | invalid if ``base_url`` is not provided. | | Methods defined here: | | __init__(self, guess=None, filename=None, url=None, file_obj=None, string=None, encoding=None, base_url=None, url_fetcher=None, media_type='print') | Initialize self. See help(type(self)) for accurate signature. | | render(self, font_config=None, counter_style=None, color_profiles=None, **options) | Lay out and paginate the document, but do not (yet) export it. | | This returns a :class:`document.Document` object which provides | access to individual pages and various meta-data. | See :meth:`write_pdf` to get a PDF directly. | | :type font_config: :class:`text.fonts.FontConfiguration` | :param font_config: | A font configuration handling ``@font-face`` rules. | :type counter_style: :class:`css.counters.CounterStyle` | :param counter_style: | A dictionary storing ``@counter-style`` rules. | :param options: | The ``options`` parameter includes by default the | :data:`DEFAULT_OPTIONS` values. | :returns: A :class:`document.Document` object. | | write_pdf(self, target=None, zoom=1, finisher=None, font_config=None, counter_style=None, color_profiles=None, **options) | Render the document to a PDF file. | | This is a shortcut for calling :meth:`render`, then | :meth:`Document.write_pdf() <document.Document.write_pdf>`. | | :type target: | :class:`str`, :class:`pathlib.Path` or :term:`file object` | :param target: | A filename where the PDF file is generated, a file object, or | :obj:`None`. | :param float zoom: | The zoom factor in PDF units per CSS units. **Warning**: | All CSS units are affected, including physical units like | ``cm`` and named sizes like ``A4``. For values other than | 1, the physical CSS units will thus be "wrong". | :type finisher: :term:`callable` | :param finisher: | A finisher function or callable that accepts the document and a | :class:`pydyf.PDF` object as parameters. Can be passed to perform | post-processing on the PDF right before the trailer is written. | :type font_config: :class:`text.fonts.FontConfiguration` | :param font_config: | A font configuration handling ``@font-face`` rules. | :type counter_style: :class:`css.counters.CounterStyle` | :param counter_style: | A dictionary storing ``@counter-style`` rules. | :param options: | The ``options`` parameter includes by default the | :data:`DEFAULT_OPTIONS` values. | :returns: | The PDF as :obj:`bytes` if ``target`` is not provided or | :obj:`None`, otherwise :obj:`None` (the PDF is written to | ``target``). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
weasyprint.HTML5_PH_STYLESHEET
Python Library Documentation: CSS in module weasyprint object class CSS(builtins.object) | CSS(guess=None, filename=None, url=None, file_obj=None, string=None, encoding=None, base_url=None, url_fetcher=None, _check_mime_type=False, media_type='print', font_config=None, counter_style=None, color_profiles=None, matcher=None, page_rules=None, layers=None, layer=None) | | CSS stylesheet parsed by tinycss2. | | An instance is created in the same way as :class:`HTML`, with the same | arguments. | | An additional argument called ``font_config`` must be provided to handle | ``@font-face`` rules. The same ``text.fonts.FontConfiguration`` object | must be used for different ``CSS`` objects applied to the same document. | | ``CSS`` objects have no public attributes or methods. They are only meant | to be used in the :meth:`HTML.write_pdf` and :meth:`HTML.render` methods | of :class:`HTML` objects. | | Methods defined here: | | __init__(self, guess=None, filename=None, url=None, file_obj=None, string=None, encoding=None, base_url=None, url_fetcher=None, _check_mime_type=False, media_type='print', font_config=None, counter_style=None, color_profiles=None, matcher=None, page_rules=None, layers=None, layer=None) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
weasyprint.HTML5_UA_COUNTER_STYLE
Python Library Documentation: CounterStyle in module weasyprint.css.counters object class CounterStyle(builtins.dict) | Counter styles dictionary. | | Keep a list of counter styles defined by ``@counter-style`` rules, indexed | by their names. | | See https://www.w3.org/TR/css-counter-styles-3/. | | Method resolution order: | CounterStyle | builtins.dict | builtins.object | | Methods defined here: | | copy(self) | D.copy() -> a shallow copy of D | | render_marker(self, counter_name, counter_value) | Generate the content of a ::marker pseudo-element. | | render_value(self, counter_value, counter_name=None, counter=None, previous_types=None) | Generate the counter representation. | | See https://www.w3.org/TR/css-counter-styles-3/#generate-a-counter | | resolve_counter(self, counter_name, previous_types=None) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.dict: | | __contains__(self, key, /) | True if the dictionary has the specified key, else False. | | __delitem__(self, key, /) | Delete self[key]. | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getitem__(self, key, /) | Return self[key]. | | __gt__(self, value, /) | Return self>value. | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __ior__(self, value, /) | Return self|=value. | | __iter__(self, /) | Implement iter(self). | | __le__(self, value, /) | Return self<=value. | | __len__(self, /) | Return len(self). | | __lt__(self, value, /) | Return self<value. | | __ne__(self, value, /) | Return self!=value. | | __or__(self, value, /) | Return self|value. | | __repr__(self, /) | Return repr(self). | | __reversed__(self, /) | Return a reverse iterator over the dict keys. | | __ror__(self, value, /) | Return value|self. | | __setitem__(self, key, value, /) | Set self[key] to value. | | __sizeof__(...) | D.__sizeof__() -> size of D in memory, in bytes | | clear(...) | D.clear() -> None. Remove all items from D. | | get(self, key, default=None, /) | Return the value for key if key is in the dictionary, else default. | | items(...) | D.items() -> a set-like object providing a view on D's items | | keys(...) | D.keys() -> a set-like object providing a view on D's keys | | pop(...) | D.pop(k[,d]) -> v, remove specified key and return the corresponding value. | | If the key is not found, return the default if given; otherwise, | raise a KeyError. | | popitem(self, /) | Remove and return a (key, value) pair as a 2-tuple. | | Pairs are returned in LIFO (last-in, first-out) order. | Raises KeyError if the dict is empty. | | setdefault(self, key, default=None, /) | Insert key with a value of default if key is not in the dictionary. | | Return the value for key if key is in the dictionary, else default. | | update(...) | D.update([E, ]**F) -> None. Update D from dict/iterable E and F. | If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] | If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v | In either case, this is followed by: for k in F: D[k] = F[k] | | values(...) | D.values() -> an object providing a view on D's values | | ---------------------------------------------------------------------- | Class methods inherited from builtins.dict: | | __class_getitem__(...) | See PEP 585 | | fromkeys(iterable, value=None, /) | Create a new dictionary with keys from iterable and values set to value. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.dict: | | __new__(*args, **kwargs) class method of builtins.dict | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes inherited from builtins.dict: | | __hash__ = None
weasyprint.HTML5_UA_FORM_STYLESHEET
Python Library Documentation: CSS in module weasyprint object class CSS(builtins.object) | CSS(guess=None, filename=None, url=None, file_obj=None, string=None, encoding=None, base_url=None, url_fetcher=None, _check_mime_type=False, media_type='print', font_config=None, counter_style=None, color_profiles=None, matcher=None, page_rules=None, layers=None, layer=None) | | CSS stylesheet parsed by tinycss2. | | An instance is created in the same way as :class:`HTML`, with the same | arguments. | | An additional argument called ``font_config`` must be provided to handle | ``@font-face`` rules. The same ``text.fonts.FontConfiguration`` object | must be used for different ``CSS`` objects applied to the same document. | | ``CSS`` objects have no public attributes or methods. They are only meant | to be used in the :meth:`HTML.write_pdf` and :meth:`HTML.render` methods | of :class:`HTML` objects. | | Methods defined here: | | __init__(self, guess=None, filename=None, url=None, file_obj=None, string=None, encoding=None, base_url=None, url_fetcher=None, _check_mime_type=False, media_type='print', font_config=None, counter_style=None, color_profiles=None, matcher=None, page_rules=None, layers=None, layer=None) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
weasyprint.HTML5_UA_STYLESHEET
Python Library Documentation: CSS in module weasyprint object class CSS(builtins.object) | CSS(guess=None, filename=None, url=None, file_obj=None, string=None, encoding=None, base_url=None, url_fetcher=None, _check_mime_type=False, media_type='print', font_config=None, counter_style=None, color_profiles=None, matcher=None, page_rules=None, layers=None, layer=None) | | CSS stylesheet parsed by tinycss2. | | An instance is created in the same way as :class:`HTML`, with the same | arguments. | | An additional argument called ``font_config`` must be provided to handle | ``@font-face`` rules. The same ``text.fonts.FontConfiguration`` object | must be used for different ``CSS`` objects applied to the same document. | | ``CSS`` objects have no public attributes or methods. They are only meant | to be used in the :meth:`HTML.write_pdf` and :meth:`HTML.render` methods | of :class:`HTML` objects. | | Methods defined here: | | __init__(self, guess=None, filename=None, url=None, file_obj=None, string=None, encoding=None, base_url=None, url_fetcher=None, _check_mime_type=False, media_type='print', font_config=None, counter_style=None, color_profiles=None, matcher=None, page_rules=None, layers=None, layer=None) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
weasyprint.LOGGER
Python Library Documentation: Logger in module logging object
class Logger(Filterer)
| Logger(name, level=0)
|
| Instances of the Logger class represent a single logging channel. A
| "logging channel" indicates an area of an application. Exactly how an
| "area" is defined is up to the application developer. Since an
| application can have any number of areas, logging channels are identified
| by a unique string. Application areas can be nested (e.g. an area
| of "input processing" might include sub-areas "read CSV files", "read
| XLS files" and "read Gnumeric files"). To cater for this natural nesting,
| channel names are organized into a namespace hierarchy where levels are
| separated by periods, much like the Java or Python package namespace. So
| in the instance given above, channel names might be "input" for the upper
| level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels.
| There is no arbitrary limit to the depth of nesting.
|
| Method resolution order:
| Logger
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, name, level=0)
| Initialize the logger with a name and an optional level.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| addHandler(self, hdlr)
| Add the specified handler to this logger.
|
| callHandlers(self, record)
| Pass a record to all relevant handlers.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. If no handler was found, output a one-off error
| message to sys.stderr. Stop searching up the hierarchy whenever a
| logger with the "propagate" attribute set to zero is found - that
| will be the last logger whose handlers are called.
|
| critical(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'CRITICAL'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.critical("Houston, we have a %s", "major disaster", exc_info=True)
|
| debug(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'DEBUG'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.debug("Houston, we have a %s", "thorny problem", exc_info=True)
|
| error(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'ERROR'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.error("Houston, we have a %s", "major problem", exc_info=True)
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Convenience method for logging an ERROR with exception information.
|
| fatal(self, msg, *args, **kwargs)
| Don't use this method, use critical() instead.
|
| findCaller(self, stack_info=False, stacklevel=1)
| Find the stack frame of the caller so that we can note the source
| file name, line number and function name.
|
| getChild(self, suffix)
| Get a logger which is a descendant to this one.
|
| This is a convenience method, such that
|
| logging.getLogger('abc').getChild('def.ghi')
|
| is the same as
|
| logging.getLogger('abc.def.ghi')
|
| It's useful, for example, when the parent logger is named using
| __name__ rather than a literal string.
|
| getChildren(self)
|
| getEffectiveLevel(self)
| Get the effective level for this logger.
|
| Loop through this logger and its parents in the logger hierarchy,
| looking for a non-zero logging level. Return the first one found.
|
| handle(self, record)
| Call the handlers for the specified record.
|
| This method is used for unpickled records received from a socket, as
| well as those created locally. Logger-level filtering is applied.
|
| hasHandlers(self)
| See if this logger has any handlers configured.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. Return True if a handler was found, else False.
| Stop searching up the hierarchy whenever a logger with the "propagate"
| attribute set to zero is found - that will be the last logger which
| is checked for the existence of handlers.
|
| info(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'INFO'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.info("Houston, we have a %s", "notable problem", exc_info=True)
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Log 'msg % args' with the integer severity 'level'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.log(level, "We have a %s", "mysterious problem", exc_info=True)
|
| makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None, sinfo=None)
| A factory method which can be overridden in subclasses to create
| specialized LogRecords.
|
| removeHandler(self, hdlr)
| Remove the specified handler from this logger.
|
| setLevel(self, level)
| Set the logging level of this logger. level must be an int or a str.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'WARNING'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| manager = <logging.Manager object>
|
| root = <RootLogger root (WARNING)>
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
weasyprint.PROGRESS_LOGGER
Python Library Documentation: Logger in module logging object
class Logger(Filterer)
| Logger(name, level=0)
|
| Instances of the Logger class represent a single logging channel. A
| "logging channel" indicates an area of an application. Exactly how an
| "area" is defined is up to the application developer. Since an
| application can have any number of areas, logging channels are identified
| by a unique string. Application areas can be nested (e.g. an area
| of "input processing" might include sub-areas "read CSV files", "read
| XLS files" and "read Gnumeric files"). To cater for this natural nesting,
| channel names are organized into a namespace hierarchy where levels are
| separated by periods, much like the Java or Python package namespace. So
| in the instance given above, channel names might be "input" for the upper
| level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels.
| There is no arbitrary limit to the depth of nesting.
|
| Method resolution order:
| Logger
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, name, level=0)
| Initialize the logger with a name and an optional level.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| addHandler(self, hdlr)
| Add the specified handler to this logger.
|
| callHandlers(self, record)
| Pass a record to all relevant handlers.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. If no handler was found, output a one-off error
| message to sys.stderr. Stop searching up the hierarchy whenever a
| logger with the "propagate" attribute set to zero is found - that
| will be the last logger whose handlers are called.
|
| critical(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'CRITICAL'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.critical("Houston, we have a %s", "major disaster", exc_info=True)
|
| debug(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'DEBUG'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.debug("Houston, we have a %s", "thorny problem", exc_info=True)
|
| error(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'ERROR'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.error("Houston, we have a %s", "major problem", exc_info=True)
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Convenience method for logging an ERROR with exception information.
|
| fatal(self, msg, *args, **kwargs)
| Don't use this method, use critical() instead.
|
| findCaller(self, stack_info=False, stacklevel=1)
| Find the stack frame of the caller so that we can note the source
| file name, line number and function name.
|
| getChild(self, suffix)
| Get a logger which is a descendant to this one.
|
| This is a convenience method, such that
|
| logging.getLogger('abc').getChild('def.ghi')
|
| is the same as
|
| logging.getLogger('abc.def.ghi')
|
| It's useful, for example, when the parent logger is named using
| __name__ rather than a literal string.
|
| getChildren(self)
|
| getEffectiveLevel(self)
| Get the effective level for this logger.
|
| Loop through this logger and its parents in the logger hierarchy,
| looking for a non-zero logging level. Return the first one found.
|
| handle(self, record)
| Call the handlers for the specified record.
|
| This method is used for unpickled records received from a socket, as
| well as those created locally. Logger-level filtering is applied.
|
| hasHandlers(self)
| See if this logger has any handlers configured.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. Return True if a handler was found, else False.
| Stop searching up the hierarchy whenever a logger with the "propagate"
| attribute set to zero is found - that will be the last logger which
| is checked for the existence of handlers.
|
| info(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'INFO'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.info("Houston, we have a %s", "notable problem", exc_info=True)
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Log 'msg % args' with the integer severity 'level'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.log(level, "We have a %s", "mysterious problem", exc_info=True)
|
| makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None, sinfo=None)
| A factory method which can be overridden in subclasses to create
| specialized LogRecords.
|
| removeHandler(self, hdlr)
| Remove the specified handler from this logger.
|
| setLevel(self, level)
| Set the logging level of this logger. level must be an int or a str.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'WARNING'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| manager = <logging.Manager object>
|
| root = <RootLogger root (WARNING)>
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
weasyprint.Page
Python Library Documentation: class Page in module weasyprint.document class Page(builtins.object) | Page(page_box) | | Represents a single rendered page. | | Should be obtained from :attr:`Document.pages` but not | instantiated directly. | | Methods defined here: | | __init__(self, page_box) | Initialize self. See help(type(self)) for accurate signature. | | paint(self, stream, scale=1) | Paint the page into the PDF file. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
weasyprint.Path
Python Library Documentation: class Path in module pathlib
class Path(PurePath)
| Path(*args, **kwargs)
|
| PurePath subclass that can make system calls.
|
| Path represents a filesystem path but unlike PurePath, also offers
| methods to do system calls on path objects. Depending on your system,
| instantiating a Path will return either a PosixPath or a WindowsPath
| object. You can also instantiate a PosixPath or WindowsPath directly,
| but cannot instantiate a WindowsPath on a POSIX system or vice versa.
|
| Method resolution order:
| Path
| PurePath
| builtins.object
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, t, v, tb)
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| absolute(self)
| Return an absolute version of this path by prepending the current
| working directory. No normalization or symlink resolution is performed.
|
| Use resolve() to get the canonical path to a file.
|
| chmod(self, mode, *, follow_symlinks=True)
| Change the permissions of the path, like os.chmod().
|
| exists(self, *, follow_symlinks=True)
| Whether this path exists.
|
| This method normally follows symlinks; to check whether a symlink exists,
| add the argument follow_symlinks=False.
|
| expanduser(self)
| Return a new path with expanded ~ and ~user constructs
| (as returned by os.path.expanduser)
|
| glob(self, pattern, *, case_sensitive=None)
| Iterate over this subtree and yield all existing files (of any
| kind, including directories) matching the given relative pattern.
|
| group(self)
| Return the group name of the file gid.
|
| hardlink_to(self, target)
| Make this path a hard link pointing to the same file as *target*.
|
| Note the order of arguments (self, target) is the reverse of os.link's.
|
| is_block_device(self)
| Whether this path is a block device.
|
| is_char_device(self)
| Whether this path is a character device.
|
| is_dir(self)
| Whether this path is a directory.
|
| is_fifo(self)
| Whether this path is a FIFO.
|
| is_file(self)
| Whether this path is a regular file (also True for symlinks pointing
| to regular files).
|
| is_junction(self)
| Whether this path is a junction.
|
| is_mount(self)
| Check if this path is a mount point
|
| is_socket(self)
| Whether this path is a socket.
|
| is_symlink(self)
| Whether this path is a symbolic link.
|
| iterdir(self)
| Yield path objects of the directory contents.
|
| The children are yielded in arbitrary order, and the
| special entries '.' and '..' are not included.
|
| lchmod(self, mode)
| Like chmod(), except if the path points to a symlink, the symlink's
| permissions are changed, rather than its target's.
|
| lstat(self)
| Like stat(), except if the path points to a symlink, the symlink's
| status information is returned, rather than its target's.
|
| mkdir(self, mode=511, parents=False, exist_ok=False)
| Create a new directory at this given path.
|
| open(self, mode='r', buffering=-1, encoding=None, errors=None, newline=None)
| Open the file pointed to by this path and return a file object, as
| the built-in open() function does.
|
| owner(self)
| Return the login name of the file owner.
|
| read_bytes(self)
| Open the file in bytes mode, read it, and close the file.
|
| read_text(self, encoding=None, errors=None)
| Open the file in text mode, read it, and close the file.
|
| readlink(self)
| Return the path to which the symbolic link points.
|
| rename(self, target)
| Rename this path to the target path.
|
| The target path may be absolute or relative. Relative paths are
| interpreted relative to the current working directory, *not* the
| directory of the Path object.
|
| Returns the new Path instance pointing to the target path.
|
| replace(self, target)
| Rename this path to the target path, overwriting if that path exists.
|
| The target path may be absolute or relative. Relative paths are
| interpreted relative to the current working directory, *not* the
| directory of the Path object.
|
| Returns the new Path instance pointing to the target path.
|
| resolve(self, strict=False)
| Make the path absolute, resolving all symlinks on the way and also
| normalizing it.
|
| rglob(self, pattern, *, case_sensitive=None)
| Recursively yield all existing files (of any kind, including
| directories) matching the given relative pattern, anywhere in
| this subtree.
|
| rmdir(self)
| Remove this directory. The directory must be empty.
|
| samefile(self, other_path)
| Return whether other_path is the same or not as this file
| (as returned by os.path.samefile()).
|
| stat(self, *, follow_symlinks=True)
| Return the result of the stat() system call on this path, like
| os.stat() does.
|
| symlink_to(self, target, target_is_directory=False)
| Make this path a symlink pointing to the target path.
| Note the order of arguments (link, target) is the reverse of os.symlink.
|
| touch(self, mode=438, exist_ok=True)
| Create this file with the given access mode, if it doesn't exist.
|
| unlink(self, missing_ok=False)
| Remove this file or link.
| If the path is a directory, use rmdir() instead.
|
| walk(self, top_down=True, on_error=None, follow_symlinks=False)
| Walk the directory tree from this directory, similar to os.walk().
|
| write_bytes(self, data)
| Open the file in bytes mode, write to it, and close the file.
|
| write_text(self, data, encoding=None, errors=None, newline=None)
| Open the file in text mode, write to it, and close the file.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| cwd()
| Return a new path pointing to the current working directory.
|
| home()
| Return a new path pointing to the user's home directory (as
| returned by os.path.expanduser('~')).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(cls, *args, **kwargs)
| Construct a PurePath from one or several strings and or existing
| PurePath objects. The strings and path objects are combined so as
| to yield a canonicalized path, which is incorporated into the
| new PurePath object.
|
| ----------------------------------------------------------------------
| Methods inherited from PurePath:
|
| __bytes__(self)
| Return the bytes representation of the path. This is only
| recommended to use under Unix.
|
| __eq__(self, other)
| Return self==value.
|
| __fspath__(self)
|
| __ge__(self, other)
| Return self>=value.
|
| __gt__(self, other)
| Return self>value.
|
| __hash__(self)
| Return hash(self).
|
| __le__(self, other)
| Return self<=value.
|
| __lt__(self, other)
| Return self<value.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| __rtruediv__(self, key)
|
| __str__(self)
| Return the string representation of the path, suitable for
| passing to system calls.
|
| __truediv__(self, key)
|
| as_posix(self)
| Return the string representation of the path with forward (/)
| slashes.
|
| as_uri(self)
| Return the path as a 'file' URI.
|
| is_absolute(self)
| True if the path is absolute (has both a root and, if applicable,
| a drive).
|
| is_relative_to(self, other, /, *_deprecated)
| Return True if the path is relative to another path or False.
|
| is_reserved(self)
| Return True if the path contains one of the special names reserved
| by the system, if any.
|
| joinpath(self, *pathsegments)
| Combine this path with one or several arguments, and return a
| new path representing either a subpath (if all arguments are relative
| paths) or a totally different path (if one of the arguments is
| anchored).
|
| match(self, path_pattern, *, case_sensitive=None)
| Return True if this path matches the given pattern.
|
| relative_to(self, other, /, *_deprecated, walk_up=False)
| Return the relative path to another path identified by the passed
| arguments. If the operation is not possible (because this is not
| related to the other path), raise ValueError.
|
| The *walk_up* parameter controls whether `..` may be used to resolve
| the path.
|
| with_name(self, name)
| Return a new path with the file name changed.
|
| with_segments(self, *pathsegments)
| Construct a new path object from any number of path-like objects.
| Subclasses may override this method to customize how new path objects
| are created from methods like `iterdir()`.
|
| with_stem(self, stem)
| Return a new path with the stem changed.
|
| with_suffix(self, suffix)
| Return a new path with the file suffix changed. If the path
| has no suffix, add given suffix. If the given suffix is an empty
| string, remove the suffix from the path.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from PurePath:
|
| anchor
| The concatenation of the drive and root, or ''.
|
| drive
| The drive prefix (letter or UNC path), if any.
|
| name
| The final path component, if any.
|
| parent
| The logical parent of the path.
|
| parents
| A sequence of this path's logical parents.
|
| parts
| An object providing sequence-like access to the
| components in the filesystem path.
|
| root
| The root of the path, if any.
|
| stem
| The final path component, minus its last suffix.
|
| suffix
| The final component's last suffix, if any.
|
| This includes the leading period. For example: '.txt'
|
| suffixes
| A list of the final component's suffixes, if any.
|
| These include the leading periods. For example: ['.tar', '.gz']
weasyprint.URLFetcher
Python Library Documentation: class URLFetcher in module weasyprint.urls class URLFetcher(urllib.request.OpenerDirector) | URLFetcher(timeout=10, ssl_context=None, http_headers=None, allowed_protocols=None, allow_redirects=True, fail_on_errors=False, **kwargs) | | Fetcher of external resources such as images or stylesheets. | | :param int timeout: The number of seconds before HTTP requests are dropped. | :param ssl.SSLContext ssl_context: An SSL context used for HTTPS requests. | :param dict http_headers: Additional HTTP headers used for HTTP requests. | :type allowed_protocols: :term:`sequence` | :param allowed_protocols: A set of authorized protocols, :obj:`None` means all. | :param bool allow_redirects: Whether HTTP redirects must be followed. | :param bool fail_on_errors: Whether HTTP errors should stop the rendering. | | Another class inheriting from this class, with a ``fetch`` method that has a | compatible signature, can be given as the ``url_fetcher`` argument to | :class:`weasyprint.HTML` or :class:`weasyprint.CSS`. | | See :ref:`URL Fetchers` for more information and examples. | | Method resolution order: | URLFetcher | urllib.request.OpenerDirector | builtins.object | | Methods defined here: | | __call__(self, url) | Call self as a function. | | __init__(self, timeout=10, ssl_context=None, http_headers=None, allowed_protocols=None, allow_redirects=True, fail_on_errors=False, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | fetch(self, url, headers=None) | Fetch a given URL. | | :returns: A :obj:`URLFetcherResponse` instance. | :raises: An exception indicating failure, e.g. :obj:`ValueError` on | syntactically invalid URL. All exceptions are catched internally by | WeasyPrint, except when they inherit from :obj:`FatalURLFetchingError`. | | open(self, url, data=None, timeout=None) | | ---------------------------------------------------------------------- | Methods inherited from urllib.request.OpenerDirector: | | add_handler(self, handler) | | close(self) | | error(self, proto, *args) | | ---------------------------------------------------------------------- | Data descriptors inherited from urllib.request.OpenerDirector: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
weasyprint.VERSION
Error rendering doc: No Python documentation found for '69.0'. Use help() to get the interactive help utility. Use help(str) for help on the str class.
weasyprint.datetime
Python Library Documentation: class datetime in module datetime class datetime(date) | datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]]) | | The year, month and day arguments are required. tzinfo may be None, or an | instance of a tzinfo subclass. The remaining arguments may be ints. | | Method resolution order: | datetime | date | builtins.object | | Methods defined here: | | __add__(self, value, /) | Return self+value. | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __le__(self, value, /) | Return self<=value. | | __lt__(self, value, /) | Return self<value. | | __ne__(self, value, /) | Return self!=value. | | __radd__(self, value, /) | Return value+self. | | __reduce__(...) | __reduce__() -> (cls, state) | | __reduce_ex__(...) | __reduce_ex__(proto) -> (cls, state) | | __repr__(self, /) | Return repr(self). | | __rsub__(self, value, /) | Return value-self. | | __str__(self, /) | Return str(self). | | __sub__(self, value, /) | Return self-value. | | astimezone(...) | tz -> convert to local time in new timezone tz | | ctime(...) | Return ctime() style string. | | date(...) | Return date object with same year, month and day. | | dst(...) | Return self.tzinfo.dst(self). | | isoformat(...) | [sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM]. | sep is used to separate the year from the time, and defaults to 'T'. | The optional argument timespec specifies the number of additional terms | of the time to include. Valid options are 'auto', 'hours', 'minutes', | 'seconds', 'milliseconds' and 'microseconds'. | | replace(...) | Return datetime with new specified fields. | | time(...) | Return time object with same time but with tzinfo=None. | | timestamp(...) | Return POSIX timestamp as float. | | timetuple(...) | Return time tuple, compatible with time.localtime(). | | timetz(...) | Return time object with same time and tzinfo. | | tzname(...) | Return self.tzinfo.tzname(self). | | utcoffset(...) | Return self.tzinfo.utcoffset(self). | | utctimetuple(...) | Return UTC time tuple, compatible with time.localtime(). | | ---------------------------------------------------------------------- | Class methods defined here: | | combine(...) | date, time -> datetime with same date and time fields | | fromisoformat(...) | string -> datetime from a string in most ISO 8601 formats | | fromtimestamp(...) | timestamp[, tz] -> tz's local time from POSIX timestamp. | | now(tz=None) | Returns new datetime object representing current time local to tz. | | tz | Timezone object. | | If no tz is specified, uses local timezone. | | strptime(...) | string, format -> new datetime parsed from a string (like time.strptime()). | | utcfromtimestamp(...) | Construct a naive UTC datetime from a POSIX timestamp. | | utcnow(...) | Return a new datetime representing UTC day and time. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | fold | | hour | | microsecond | | minute | | second | | tzinfo | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | max = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999) | | min = datetime.datetime(1, 1, 1, 0, 0) | | resolution = datetime.timedelta(microseconds=1) | | ---------------------------------------------------------------------- | Methods inherited from date: | | __format__(...) | Formats self with strftime. | | isocalendar(...) | Return a named tuple containing ISO year, week number, and weekday. | | isoweekday(...) | Return the day of the week represented by the date. | Monday == 1 ... Sunday == 7 | | strftime(...) | format -> strftime() style string. | | toordinal(...) | Return proleptic Gregorian ordinal. January 1 of year 1 is day 1. | | weekday(...) | Return the day of the week represented by the date. | Monday == 0 ... Sunday == 6 | | ---------------------------------------------------------------------- | Class methods inherited from date: | | fromisocalendar(...) | int, int, int -> Construct a date from the ISO year, week number and weekday. | | This is the inverse of the date.isocalendar() function | | fromordinal(...) | int -> date corresponding to a proleptic Gregorian ordinal. | | today(...) | Current date or datetime: same as self.__class__.fromtimestamp(time.time()). | | ---------------------------------------------------------------------- | Data descriptors inherited from date: | | day | | month | | year
weasyprint.default_url_fetcher
Python Library Documentation: function default_url_fetcher in module weasyprint.urls
default_url_fetcher(url, timeout=10, ssl_context=None, http_headers=None, allowed_protocols=None)
Fetch an external resource such as an image or stylesheet.
This function is deprecated, use ``URLFetcher`` instead.
weasyprint.getctime
Python Library Documentation: function getctime in module genericpath
getctime(filename)
Return the metadata change time of a file, reported by os.stat().
weasyprint.getmtime
Python Library Documentation: function getmtime in module genericpath
getmtime(filename)
Return the last modification time of a file, reported by os.stat().
weasyprint.preprocess_stylesheet
Python Library Documentation: function preprocess_stylesheet in module weasyprint.css
preprocess_stylesheet(device_media_type, base_url, stylesheet_rules, url_fetcher, matcher, page_rules, layers, font_config, counter_style, color_profiles, ignore_imports=False, layer=None)
Do what can be done early on stylesheet, before being in a document.
weasyprint.select_source
Python Library Documentation: function select_source in module weasyprint.urls
select_source(guess=None, filename=None, url=None, file_obj=None, string=None, base_url=None, url_fetcher=None, check_css_mime_type=False)
If only one input is given, return it.
Yield a file object, the base url, the protocol encoding and the protocol mime-type.
weasyprint.urljoin
Python Library Documentation: function urljoin in module urllib.parse
urljoin(base, url, allow_fragments=True)
Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter.