https://github.com/vikpe/domainprops
Python package for parsing domain name properties.
https://github.com/vikpe/domainprops
domain-names domains python utilities
Last synced: about 1 year ago
JSON representation
Python package for parsing domain name properties.
- Host: GitHub
- URL: https://github.com/vikpe/domainprops
- Owner: vikpe
- License: mit
- Created: 2020-05-05T20:55:03.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-03-25T09:19:14.000Z (over 4 years ago)
- Last Synced: 2025-02-28T12:43:15.059Z (over 1 year ago)
- Topics: domain-names, domains, python, utilities
- Language: Python
- Homepage:
- Size: 33.2 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Domainprops
> Python package for parsing domain name properties
[](https://github.com/vikpe/domainprops/actions) [](https://codecov.io/gh/vikpe/domainprops) [](https://github.com/psf/black)
## Install
```shell script
python -m pip install domainprops
```
## Usage
```python
from domainprops import domainprops
domainprops.tld("foo.com") # "com"
domainprops.sld("foo.com") # "foo"
domainprops.is_alpha("foo.com") # True
domainprops.is_numeric("foo.com") # False
```
## API
Function | Returns | Description | Example | Result
--- | --- | --- | --- | ---
`tld` | `string` | Top level domain | `tld("foo.com")` | `"com"`
`sld` | `string` | Sub level domain | `sld("foo.bar.com")` | `"foo.bar"`
`bld` | `string` | Bottom level domain | `bld("foo.bar.com")` | `"foo"`
`length` | `int` | Lenght of domain | `length("foo.com")` | `3`
`idn` | `string` | IDN version of domain | `idn("fââ.com")` | `"xn--f-vioa.com"`
`pattern` | `string` | Char pattern | `pattern("foo-123.com")` | `"lll-nnn"`
`domains` | `list` | Domain parts of domain | `domains("foo.bar.com")` | `["foo", "bar", "com"]`
`has_alpha` | `bool` | Has alpha characters | `has_alpha("foo.com")` | `True`
`has_numbers` | `bool` | Has numbers | `has_numbers("foo.com")` | `False`
`has_hyphens` | `bool` | Has hyphens | `has_hyphens("foo.com")` | `False`
`is_alpha` | `bool` | Is strictly alpha characters | `is_alpha("foo.com")` | `True`
`is_numeric` | `bool` | Is strictly numbers | `is_numeric("foo.com")` | `False`
`is_alphanumeric` | `bool` | Is strictly alpha characters and/or numbers | `is_alphanumeric("foo.com")` | `True`
`is_subdomain` | `bool` | Is sub domain | `is_subdomain("foo.com")` | `False`