CLI¶
Problematic¶
How can we easily work and distribute some CLI related logic?
Documentation¶
The tool to check the availability or syntax of domains, IPv4, IPv6 or URL.
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ ██████╔╝██║ █████╗
██╔═══╝ ╚██╔╝ ██╔══╝ ██║ ██║██║╚██╗██║██║ ██╔══╝ ██╔══██╗██║ ██╔══╝
██║ ██║ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝
Provides the CLI entry points.
- 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.
Dispatcher()
¶
-
class
PyFunceble.cli.dispatcher.
Dispatcher
(preset, domain_or_ip=None, file_path=None, url_file_path=None, url_to_test=None, generate_results_only=False, generate_all_results_only=False)[source]¶ Dispatches to one of the other brain.
Note
We are talking about
brain
because, eachPyFunceble.core.*
is a unique brain which has it’s own function ;-)Sometimes, 2 brains depends from the other one. But that’s great because working together is always great ;-)
Parameters: - preset (
Preset
) – An instance of the configuration preset. - domain_or_ip (list) – A list of subject to test.
- file_path (str) –
A file path or a link.
Note
If a file path is given, we read and test its content.
Note
If a link is given, we download it’s content and test it.
Warning
If given, we consider each line to be an adblock filter, a host file format or a subject to test.
- url_file_path (str) –
A file path or a link.
Note
If a file path is given, we read and test its content.
Note
If a link is given, we download it’s content and test it.
Warning
If given, we consider each line to be a URL to test.
- url_to_test (str) – A list of URL to test.
-
classmethod
dispatch_file_test
(file_path, generate_results_only, generate_all_results_only)[source]¶ Dispatches to the brain in charge of file testing.
Parameters: - file_path (str) – The file path to test.
- generate_results_only (bool) – Tell us to only regenerate from the data stored into the MariaDB/MySQL databases.
- generate_all_results_only (bool) –
Tell us to only regenerate from the data stored into the MariaDB/MySQL databases.
Note
The difference with
generate_results_only
is that it includes the retested which status didn’t changed.
- preset (
ExecutionTime()
¶
-
class
PyFunceble.cli.execution_time.
ExecutionTime
(action='start', last=False)[source]¶ Sets and returns the execution time of the program.
Parameters: Checks the execution authorization.
Returns: The authorization status. Return type: bool
-
classmethod
calculate
(start=None, end=None)[source]¶ Calculates the difference between starting and ending time.
Parameters: Returns: A dict with following as index.
days
hours
minutes
seconds
as index.
Return type:
-
format_execution_time
(start=None, end=None)[source]¶ Formats the calculated time into a human readable format.
Parameters: Returns: A human readable date.
Return type: