PyFunceble.query package

Submodules

PyFunceble.query.collection module

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

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

Provides ans interface which let us interact with the Collection 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 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.query.collection.CollectionQueryTool(*, token: Optional[str] = None, url_base: Optional[str] = None, preferred_status_origin: Optional[str] = None)[source]

Bases: object

Provides the interface to the collection dataset.

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 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_PREFERRED_STATUS_ORIGIN = 'frequent'
STD_URL_BASE = 'http://localhost:8001'
SUPPORTED_CHECKERS = ['syntax', 'reputation', 'availability']
SUPPORTED_STATUS_ORIGIN = ['frequent', 'latest', 'recommended']
guess_all_settings() → PyFunceble.query.collection.CollectionQueryTool[source]

Try to guess all settings.

guess_and_set_preferred_status_origin() → PyFunceble.query.collection.CollectionQueryTool[source]

Try to guess the preferred status origin.

guess_and_set_url_base() → PyFunceble.query.collection.CollectionQueryTool[source]

Try to guess the URL base to work with.

preferred_status_origin

Provides the value of the _preferred_status_origin attribute.

pull(subject: str) → Optional[dict][source]

Pulls all data related to the subject or None

Parameters:subject – The subject to search for.
Raises:TypeError – When the given subject is not a str.
Returns:The response of the search.
push(checker_status: Union[PyFunceble.checker.availability.status.AvailabilityCheckerStatus, PyFunceble.checker.syntax.status.SyntaxCheckerStatus, PyFunceble.checker.reputation.status.ReputationCheckerStatus]) → Optional[dict][source]

Push the given status to the collection.

Parameters:

checker_status – The status to push.

Raises:
  • TypeError
    • When the given checker_status is not a AvailabilityCheckerStatus, SyntaxCheckerStatus or ReputationCheckerStatus.
    • When the given checker_status.subject is not a str.
  • ValueError – When the given checker_status.subject is empty.
session = None
set_preferred_status_origin(value: str) → PyFunceble.query.collection.CollectionQueryTool[source]

Sets the preferred status origin.

Parma value:The value to set.
set_token(value: str) → PyFunceble.query.collection.CollectionQueryTool[source]

Sets the value of the _token attribute.

Parameters:value – The value to set.
set_url_base(value: str) → PyFunceble.query.collection.CollectionQueryTool[source]

Sets the base of the URL to work with.

Parma value:The value to set.
token

Provides the currently set token.

url_base

Provides the value of the _url_base attribute.

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

Bases: object

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

STD_ALLOW_REDIRECTS = False
STD_TIMEOUT = 5.0
STD_UNKNOWN_STATUS_CODE = 99999999
STD_VERIFY_CERTIFICATE = True
allow_redirects

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() → PyFunceble.query.http_status_code.HTTPStatusCode[source]

Tries to guess and set the timeout from the configuration.

guess_and_set_verify_certificate() → PyFunceble.query.http_status_code.HTTPStatusCode[source]

Tries to guess and set the verify_certificate attribute.

set_allow_redirects(value: bool) → PyFunceble.query.http_status_code.HTTPStatusCode[source]

Sets the value of the verify_certificate variable.

Parameters:value – The value to set.
set_subject(value: str) → PyFunceble.query.http_status_code.HTTPStatusCode[source]

Sets the subject to work with.

Parameters:value – The subject to set.
set_timeout(value: Union[float, int]) → PyFunceble.query.http_status_code.HTTPStatusCode[source]

Sets the timeout to apply.

Parameters:value – The timeout to apply.
set_verify_certificate(value: bool) → PyFunceble.query.http_status_code.HTTPStatusCode[source]

Sets the value of the verify_certificate variable.

Parameters:value – The value to set.
subject

Provides the current state of the _subject attribute.

timeout

Provides the current state of the _timeout attribute.

verify_certificate

Provides the current state of the verify_certificate 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 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.