Code documentation¶
domain2idna - The tool to convert a domain or a file with a list of domain to the famous IDNA format.
- Author:
- Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
- Contributors:
- Let’s contribute to domains2idna!!
- Project link:
- https://github.com/PyFunceble/domain2idna
- Project documentation:
- http://domain2idna.readthedocs.io
License:
MIT License
Copyright (c) 2019, 2020, 2021, 2022 PyFunceble
Copyright (c) 2018, 2019, 2020, 2021, 2022 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.
-
domain2idna.
domain2idna
(subject, encoding='utf-8')[source]¶ Process the conversion of the given subject.
Parameters: - subject (str, list) – The subject to convert.
- encoding (str) – The encoding to provide.
Return type: list, str
-
domain2idna.
get
(domain_to_convert)[source]¶ This function is a passerelle between the front and the backend of this module.
Parameters: domain_to_convert (str) – The domain to convert. Returns: - str:
- if a string is given.
- list:
- if a list is given.
Return type: str, list Deprecated since version 1.10.0: Use
domain2idna()
instead.
Helpers¶
Problematic¶
How can we write, read and delete a file without having to write everytime the same thing?
Code documentation¶
File()
¶
-
class
domain2idna.helpers.
File
(filename)[source]¶ File treatment/manipulations.
Parameters: filename (str) – A path to the file to manipulate. -
delete
()[source]¶ Deletes a given file path.
Warning
We handle the case that the file does not exist.
-
Converter¶
Code documentation¶
-
class
domain2idna.converter.
Converter
(subject, original_encoding='utf-8')[source]¶ Provides a base for every core logic we add.
Parameters: - subject (str, list) – The subject to convert.
- original_encoding (str) – The encoding to provide as output.