Database

Problematic

How can we store our most relevant information?

Documentation

The tool to check the availability or syntax of domains, IPv4, IPv6 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:

MIT License

Copyright (c) 2017, 2018, 2019, 2020 Nissar Chababy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

InactiveDB()

class PyFunceble.database.inactive.InactiveDB(filename, mysql_db=None, 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_retest_already_tested(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.

get_already_tested()[source]

Returns a set of already tested subjects.

get_table_name()[source]

Returns the name of the table to use.

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.

classmethod timestamp()[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

WhoisDB()

class PyFunceble.database.whois.WhoisDB(mysql_db=None, 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
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.