Source code for

# -*- coding: utf-8 -*-
# pylint: disable=ungrouped-imports
"""Data URI Schemes

The :mod:`` module is customised to
handle data URI schemes.


from typing import TYPE_CHECKING

from darc.error import LinkNoReturn
from darc.logging import logger
from import save_data
from darc.sites._abc import BaseSite

    from typing import NoReturn

    from requests import Session
    from selenium.webdriver import Chrome as Driver

    import as darc_link  # Link
    from darc._compat import datetime

[docs]class DataURI(BaseSite): """Data URI schemes."""
[docs] @staticmethod def crawler(timestamp: 'datetime', session: 'Session', link: 'darc_link.Link') -> 'NoReturn': # pylint: disable=unused-argument """Crawler hook for data URIs. Args: timestamp: Timestamp of the worker node reference. session (:class:`requests.Session`): Session object with proxy settings. link: Link object to be crawled. Raises: LinkNoReturn: This link has no return response. """ try: save_data(link) except ValueError: logger.pexc(message=f'[REQUESTS] Failed to save data URI from {link.url}') raise LinkNoReturn(link)
[docs] @staticmethod def loader(timestamp: 'datetime', driver: 'Driver', link: 'darc_link.Link') -> 'NoReturn': # pylint: disable=unused-argument """Not implemented. Raises: LinkNoReturn: This hook is not implemented. """ raise LinkNoReturn(link)