PyFunceble.dataset package

Submodules

PyFunceble.dataset.base module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the base of all datasets classes.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.dataset.base.DatasetBase[source]

Bases: object

Provides the base of all dataset.

DOWNLOADER = None
STORAGE_INDEX = None
ensure_source_file_exists()[source]

Ensures that the source file exists before running the decorated method.

Raises:
get_content() → Optional[dict][source]

Provides the cached or the real contend of the dataset (after caching)

Raises:FileNotFoundError – When the declared file does not exists.
source_file = None

PyFunceble.dataset.csv_base module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the base of all CSV storeed datasets.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.dataset.csv_base.CSVDatasetBase(*, authorized: Optional[bool] = None, remove_unneeded_fields: Optional[bool] = None)[source]

Bases: PyFunceble.dataset.db_base.DBDatasetBase

Provides the base of all CSV dataset.

add(row: dict) → PyFunceble.dataset.csv_base.CSVDatasetBase[source]

Adds the given dataset into the CSV file.

Parameters:row – The row or dataset to add.
Raises:TypeError – When the given row is not a :py:class`dict`.
are_equal(read_row: dict, row: dict) → bool[source]

Compares the given read_row to the row.

Parameters:
  • read_row – The row read from the dataset infrastructure.
  • row – The row given by the testing infrastructure.
exists(row: dict) → bool[source]

Checks if the given dataset exists in our dataset.

Parameters:row – The row or dataset to check.
get_content() → Generator[Optional[dict], None, None][source]

Provides a generator which provides the next line to read.

get_csv_writer() → Tuple[csv.DictWriter, io.open][source]

Provides the standard and initiated CSV Dict writer along with the file that was open with it.

get_filtered_comparision_row(row: dict)[source]

Makes the given row ready for comparison.

get_filtered_content(filter_map: dict) → Generator[Optional[dict], None, None][source]

Provides a generator which provides the next line to read.

Parameters:filter_map – A dictionary representing what we need to filter.
Raises:TypeError – When the given filter_map is not a dict.
remove(row: dict) → PyFunceble.dataset.csv_base.CSVDatasetBase[source]

Removes the given dataset from the CSV file.

Parameters:row – The row or dataset to add.
Raises:TypeError – When the given row is not a :py:class`dict`.
update(row: dict, *, ignore_if_exist: bool = False) → PyFunceble.dataset.db_base.DBDatasetBase[source]

Adds the given dataset into the database if it does not exists. Update otherwise.

Parameters:
  • row – The row or dataset to manipulate.
  • ignore_if_exist – Ignore the insertion/update if the row already exists.
Raises:

TypeError – When the given row is not a :py:class`dict`.

PyFunceble.dataset.db_base module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the base of all datasets which acts as database interface.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.dataset.db_base.DBDatasetBase(*, authorized: Optional[bool] = None, remove_unneeded_fields: Optional[bool] = None)[source]

Bases: PyFunceble.dataset.base.DatasetBase

Provides the base of all datasets which acts as database interface.

COMPARISON_FIELDS = []
FIELDS = []
STD_AUTHORIZED = False
STD_REMOVE_UNNEEDED_FIELDS = True
add(row: dict) → PyFunceble.dataset.db_base.DBDatasetBase[source]

Adds the given dataset into the database.

Parameters:row – The row or dataset to add.
Raises:TypeError – When the given row is not a :py:class`dict`.
are_equal(read_row: dict, row: dict) → bool[source]

Compares the given read_row to the row.

Parameters:
  • read_row – The row read from the dataset infrastructure.
  • row – The row given by the testing infrastructure.
authorized

Provides the current state of the _authorized attribute.

cleanup() → PyFunceble.dataset.db_base.DBDatasetBase[source]

Cleanups the dataset.

execute_if_authorized()[source]

Executes the decorated method only if we are authorized to process. Otherwise, apply the given default.

exists(row: dict) → bool[source]

Checks if the given dataset exists in our dataset.

Parameters:row – The row or dataset to add.
get_content() → Generator[Optional[dict], None, None][source]

Provides a generator which provides the next line to read.

get_filtered_content(filter_map: dict) → Generator[Optional[dict], None, None][source]

Provides a generator which provides the next dataset. to read.

Parameters:filter_map – A dictionary representing what we need to filter.
Raises:TypeError – When the given filter_map is not a dict.
get_filtered_row(row: dict) → dict[source]

Removes all unkowns fields (not declared) from the given row.

Parameters:row – The row to work with.
remove(row: dict) → PyFunceble.dataset.db_base.DBDatasetBase[source]

Removes the given dataset from the database.

Parameters:row – The row or dataset to remove.
Raises:TypeError – When the given row is not a :py:class`dict`.
remove_unneeded_fields

Provides the current state of the _remove_unneeded_fields.

set_authorized(value: bool) → PyFunceble.dataset.db_base.DBDatasetBase[source]

Sets the value of the _authorized attribute.

Parameters:value – The value to set.
set_remove_unneeded_fields(value: bool) → PyFunceble.dataset.db_base.DBDatasetBase[source]

Sets the value of the _remove_unneeded_fields attribute.

Parameters:value – The value to set.
source_file = None
update(row: dict, *, ignore_if_exist: bool = False) → PyFunceble.dataset.db_base.DBDatasetBase[source]

Adds the given dataset into the database if it does not exists. Update otherwise.

Parameters:
  • row – The row or dataset to manipulate.
  • ignore_if_exist – Ignores the insertion/update if the row already exists.
Raises:

TypeError – When the given row is not a :py:class`dict`.

PyFunceble.dataset.iana module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides an interface which let us interact with the IANA database.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.dataset.iana.IanaDataset[source]

Bases: PyFunceble.dataset.base.DatasetBase

Provides the dataset handler for the IANA dataset.

DOWNLOADER = <PyFunceble.downloader.iana.IANADownloader object>
STORAGE_INDEX = 'IANA'
get_whois_server(extension: str) → Optional[str][source]

Provides the WHOIS server of the given dataset.

is_extension(extension: str) → bool[source]

Checks if the given extension is registered.

Raises:TypeError – When extension is not a str.

PyFunceble.dataset.ipv4_reputation module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides an interface which let us interact with the IPv4 reputation database.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.dataset.ipv4_reputation.IPV4ReputationDataset[source]

Bases: PyFunceble.dataset.base.DatasetBase

Provides the interface for the lookup of the IPv4 reputation.

DOWNLOADER = <PyFunceble.downloader.ipv4_reputation.IPV4ReputationDownloader object>
STORAGE_INDEX = None
get_content() → io.open[source]

Provides a file handler which does let you read the content line by line.

Raises:FileNotFoundError – When the declared file does not exists.

PyFunceble.dataset.public_suffix module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides an interface which let us interact with the Public Suffix List.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.dataset.public_suffix.PublicSuffixDataset[source]

Bases: PyFunceble.dataset.base.DatasetBase

Provides the dataset handler for the Public Suffix List dataset.

DOWNLOADER = <PyFunceble.downloader.public_suffix.PublicSuffixDownloader object>
STORAGE_INDEX = 'PUBLIC_SUFFIX'
get_available_suffix(extension: str) → List[str][source]

Provides the available suffix for the extension.

is_extension(extension: str) → bool[source]

Checks if the given extension is registered.

Raises:TypeError – When extension is not a str.

PyFunceble.dataset.sql_base module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the base of all Mariadb stored datasets.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.dataset.sql_base.SQLDBDatasetBase(*, authorized: Optional[bool] = None, remove_unneeded_fields: Optional[bool] = None, db_session: Optional[sqlalchemy.orm.session.Session] = None)[source]

Bases: PyFunceble.dataset.db_base.DBDatasetBase

Provides the base of all SQLDB stored dataset.

ORM_OBJ = None
STD_KEEP_SESSION_OPEN = False
add(row) → PyFunceble.dataset.sql_base.SQLDBDatasetBase[source]

Adds the given dataset into the database.

Parameters:row – The row or dataset to add.
Raises:TypeError – When the given row is not a dict or sqlalchemy schema.
db_session = None
ensure_orm_obj_is_given()[source]

Ensures that the ORM object is given before launching the decorated method.

Raises:RuntimeError – When ORM_OBJ is not declared.
exists(row) → bool[source]

Checks if the given dataset exists in our dataset.

Parameters:row – The row or dataset to check.
Raises:TypeError – When the given row is not a dict or sqlalchemy schema.
get_content() → Generator[dict, None, None][source]

Provides a generator which provides the next dataset to read.

get_existing_row(row)[source]

Returns the matching row.

Parameters:row – The row or dataset to check,
get_existing_row_id(row)[source]

Returns the ID of the existing row.

Parameters:row – The row or dataset to check,
remove(row) → PyFunceble.dataset.sql_base.SQLDBDatasetBase[source]

Removes the given dataset from the database.

Parameters:row – The row or dataset to check.
Raises:TypeError – When the given row is not a dict or sqlalchemy schema.
update(row, *, ignore_if_exist: bool = False) → PyFunceble.dataset.sql_base.SQLDBDatasetBase[source]

Adds the given dataset into the database if it does not exists. Update otherwise.

Note

This should be the preferred method for introduction of new dataset.

Raises:TypeError – When the given row is not a dict or sqlalchemy schema.

PyFunceble.dataset.user_agent module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides an interface which let us interact with the Public Suffix List.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.dataset.user_agent.UserAgentDataset[source]

Bases: PyFunceble.dataset.base.DatasetBase

Provides the dataset and infrastructure for the User Agent navigation

DOWNLOADER = <PyFunceble.downloader.user_agents.UserAgentsDownloader object>
STORAGE_INDEX = 'USER_AGENTS'
get_latest() → str[source]

Provides the latest user agent for the given platform.

Side Effect:
It tries to get the platform and browser from the configuration (if exists).
is_supported(browser_short_name: str, platform: str) → bool[source]

Checks if the given browser and platform is supported.

Parameters:
  • browser_short_name – The short name of the browser.
  • platform – The platform name.
Raises:

TypeError – When browser_short_name or platform are not str.

is_supported_browser(browser_short_name: str) → bool[source]

Checks if the given browser is supported.

Raises:TypeError – When browser_short_name is not a str.
prefered_browser = 'chrome'
prefered_platform = 'linux'
set_prefered(browser_short_name: str, platform: str) → PyFunceble.dataset.user_agent.UserAgentDataset[source]

Sets the prefered browser to work with.

Parameters:

browser_short_name – The name of the browser to select.

Pram platform:

The name of the platform to select.

Raises:

Module contents

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides all the dataset interaction submodules

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.