Expiration Date¶
Problematic¶
How can we get the expiration date of a given domain from the WHOIS record?
Documentation¶
The tool to check the availability or syntax of domains, IPv4 or URL.
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ ██████╔╝██║ █████╗
██╔═══╝ ╚██╔╝ ██╔══╝ ██║ ██║██║╚██╗██║██║ ██╔══╝ ██╔══██╗██║ ██╔══╝
██║ ██║ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝
This submodule will provide the exipration date extraction logic.
- 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 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.
-
class
PyFunceble.expiration_date.
ExpirationDate
(subject, whois_server, filename=None, whois_db=None)[source]¶ Get, format and return the expiration date of a domain, if exist.
Parameters: - subject (str) – The subject we are working with.
- whois_server (str) – The whois server we are trying to get get the expiration date from.
- whois_db (
PyFunceble.whois_db.WhoisDB()
) – An instance of the whois database. - filename (str) – The name of the file we are working with.
-
_ExpirationDate__extract_from_record
()¶ Extract the expiration date from the whois record.
-
_cases_management
(regex_number, matched_result)[source]¶ A little internal helper of self.format. (Avoiding of nested loops)
Note
Please note that the second value of the case represent the groups in order
[day,month,year]
.This means that a
[2,1,0]
will be for example for a date in format2017-01-02
where01
is the month.Parameters: - regex_number (int) – The identifiant of the regex.
- matched_result (list) – The matched result to format.
Returns: A list representing the expiration date. The list can be “decoded” like
[day, month, year]
Return type: list|None
-
classmethod
_convert_1_to_2_digits
(number)[source]¶ Convert 1 digit number to two digits.
Parameters: number (str|int) – A number or a digit string. Returns: A 2 or more digit string. Return type: str
-
classmethod
_convert_or_shorten_month
(data)[source]¶ Convert a given month into our unified format.
Parameters: data (str) – The month to convert or shorten. Returns: The unified month name. Return type: str