PyFunceble.query package

Subpackages

Submodules

PyFunceble.query.http_status_code module

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

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

Provides our interface for getting the status code of a given subject.

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/dev/

Project homepage:

https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 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

    https://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.query.http_status_code.HTTPStatusCode(subject: str | None = None, *, timeout: float | None = None, verify_certificate: bool | None = None, allow_redirects: bool | None = None)[source]

Bases: object

Provides an interface for the extration of the HTTP status code.

STD_ALLOW_REDIRECTS: bool = False
STD_TIMEOUT: float = 5.0
STD_UNKNOWN_STATUS_CODE: int = 99999999
STD_VERIFY_CERTIFICATE: bool = True
property allow_redirects: bool

Provides the current state of the _allow_redirects attribute.

ensure_subject_is_given()[source]

Ensures that the subject is given before running the decorated method.

Raises:

TypeError – If the subject is not a string.

get_status_code() int[source]

Provides the status code.

Note

The HTTP status code provided will differs regarding the following conditions.

Assuming, that allow_redirects is set to False, you will be provided the following:

On the other site if the allow_redirects property is set to True, this method will provide the status of the last one in the redirection order.

In case of any error, this method will provide the default one.

guess_and_set_timeout() HTTPStatusCode[source]

Tries to guess and set the timeout from the configuration.

guess_and_set_verify_certificate() HTTPStatusCode[source]

Tries to guess and set the verify_certificate attribute.

set_allow_redirects(value: bool) HTTPStatusCode[source]

Sets the value of the verify_certificate variable.

Parameters:

value – The value to set.

set_subject(value: str) HTTPStatusCode[source]

Sets the subject to work with.

Parameters:

value – The subject to set.

set_timeout(value: float | int) HTTPStatusCode[source]

Sets the timeout to apply.

Parameters:

value – The timeout to apply.

set_verify_certificate(value: bool) HTTPStatusCode[source]

Sets the value of the verify_certificate variable.

Parameters:

value – The value to set.

property subject: str | None

Provides the current state of the _subject attribute.

property timeout: float

Provides the current state of the _timeout attribute.

property verify_certificate: bool

Provides the current state of the verify_certificate attribute.

PyFunceble.query.platform module

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

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

Provides ans interface which let us interact with the platform API.

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/dev/

Project homepage:

https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 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

    https://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.query.platform.PlatformQueryTool(*, token: str | None = None, preferred_status_origin: str | None = None, timeout: float | None = None, checker_priority: List[str] | None = None, checker_exclude: List[str] | None = None)[source]

Bases: object

Provides the interface to interact with the platform.

Parameters:
  • token

    The token to use to communicate with the API.

    Warning

    If None is given, the class constructor will try to load the PYFUNCEBLE_COLLECTION_API_TOKEN or PYFUNCEBLE_PLATFORM_API_TOKEN environment variable.

  • url_base – The base of the URL to communicate with.

  • preferred_status_origin – The preferred data origin. It can be frequent, latest or recommended.

STD_CHECKER_EXCLUDE: str = ['none']
STD_CHECKER_PRIORITY: str = ['none']
STD_PREFERRED_STATUS_ORIGIN: str = 'frequent'
STD_TIMEOUT: float = 5.0
SUBJECT: str = '109272947111272947992729474627294711527294711627294711527294711127294710427294745272947100272947972729471012729471002729474627294797272947116272947101272947982729474627294710527294711227294797272947472729474727294758272947115272947112272947116272947116272947104'
SUPPORTED_CHECKERS: List[str] = ['syntax', 'reputation', 'availability']
SUPPORTED_STATUS_ORIGIN: List[str] = ['frequent', 'latest', 'recommended']
property checker_exclude: List[str] | None

Provides the value of the _checker_exclude attribute.

property checker_priority: List[str] | None

Provides the value of the _checker_priority attribute.

deliver_contract(*args, **kwargs)[source]
ensure_modern_api()[source]

Ensures that the is_modern_api attribute is set before running the decorated method.

guess_all_settings() PlatformQueryTool[source]

Try to guess all settings.

guess_and_set_checker_exclude() PlatformQueryTool[source]

Try to guess the checker to exclude.

guess_and_set_checker_priority() PlatformQueryTool[source]

Try to guess the checker priority to use.

guess_and_set_is_modern_api() PlatformQueryTool[source]

Try to guess if we are working with a legacy version.

guess_and_set_preferred_status_origin() PlatformQueryTool[source]

Try to guess the preferred status origin.

guess_and_set_timeout() PlatformQueryTool[source]

Try to guess the timeout to use.

property is_modern_api: bool

Provides the value of the _is_modern_api attribute.

property preferred_status_origin: str | None

Provides the value of the _preferred_status_origin attribute.

pull(*args, **kwargs)[source]
pull_contract(*args, **kwargs)[source]
push(*args, **kwargs)[source]
session: Session | None = None
set_checker_exclude(value: List[str]) PlatformQueryTool[source]

Sets the checker to exclude.

Parma value:

The value to set.

set_checker_priority(value: List[str]) PlatformQueryTool[source]

Sets the checker priority.

Parma value:

The value to set.

set_is_modern_api(value: bool) PlatformQueryTool[source]

Sets the value of the _is_modern_api attribute.

Parameters:

value – The value to set.

set_preferred_status_origin(value: str) PlatformQueryTool[source]

Sets the preferred status origin.

Parma value:

The value to set.

set_timeout(value: float) PlatformQueryTool[source]

Sets the value of the _timeout attribute.

Parameters:

value – The value to set.

set_token(value: str) PlatformQueryTool[source]

Sets the value of the _token attribute.

Parameters:

value – The value to set.

set_url_base(value: str) PlatformQueryTool[source]

Sets the base of the URL to work with.

Parma value:

The value to set.

property timeout: float

Provides the value of the _timeout attribute.

property token: str | None

Provides the currently set token.

property url_base: str | None

Provides the value of the _url_base attribute.

Module contents

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

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

Provides everything related queries and communication with target resources and information.

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/dev/

Project homepage:

https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 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

    https://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.