Database

Problematic

How can we store our most relevant information?

Documentation

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

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

Provides the database interfaces.

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

License:

Copyright 2017, 2018, 2019, 2020 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.

InactiveDB()

class PyFunceble.database.inactive.InactiveDB(filename, parent_process=False)[source]

Provides the inactive database logic and interface.

Parameters:filename (str) – The name of the file we are processing.
_InactiveDB__execute_query(query)

Executes the query to get the list to retest or already tested.

_merge()[source]

Merges the database with the older one which has already been set into the database.

add(subject, status)[source]

Adds the given subject into the database.

Parameters:
  • subject (str) – The subject we are working with.
  • status (str) – The status of the given subject.
classmethod authorization()[source]

Provides the execution authorization.

clean()[source]

Cleans everything which is not needed anymore.

classmethod datetime()[source]

Gets the timestamp where we are going to save our current list.

Returns:The timestamp to append with the currently tested element.
Return type:int|str
get_already_tested()[source]

Returns a set of already tested subjects.

classmethod get_table_name()[source]

Returns the name of the table to use.

get_to_clean()[source]

Returns a set of subject to clean from the database.

get_to_retest()[source]

Returns a set of subject to restest.

initiate()[source]

Initiates the databsse.

load()[source]

Loads the content of the database file.

remove(subject)[source]

Removes all occurrences of the given subject from the database.

Parameters:subject (str) – The subject we are working with.
save()[source]

Saves the current database into the database file.

WhoisDB()

class PyFunceble.database.whois.WhoisDB(parent_process=False)[source]

Provides the WHOIS database interface and logic.

add(subject, expiration_date, record=None)[source]

Adds the given subject and expiration date to the database.

Parameters:
  • subject (str) – The subject we are working with.
  • expiration_date (str) – The extracted expiration date.
  • record (str) – The WHOIS record.
classmethod authorization()[source]

Provides the operation authorization.

get_expiration_date(subject)[source]

Gets the expiration date of the given subject.

Parameters:subject (str) – The subject we are working with.
Returns:The expiration date from the database.
Return type:str|None
classmethod get_table_name()[source]

Returns the name of the table to use.

is_time_older(subject)[source]

Checks if the expiration time of the given subject is older.

Parameters:subject (str) – The subject we are working with.

Note

Of course, we imply that the subject is in the database.

load()[source]

Loads the database file into the database.

classmethod merge(old)[source]

Merges the older version of the database into the new version.

Parameters:old (dict) – The old version of the database.
Returns:The database in the new format.
Return type:dict
save()[source]

Saves the database into the database file.