Parse url and get all the different parts out of it
Project description
URL Parser
A small yet nice package to help you parse all types of url`s and return the parsed url with group name.
Installation
pip install url-parser
Usage
from url_parser import parse_url
parsed_url = parse_url('https://open.prospecta.app')
print(pared_url)
>>> {'http': 'https://', 'www': None, 'sub_domain': 'open.', 'domain': 'prospecta', 'top_domain': 'app', 'dir': 'app'}
keywords
You can call the package with specific keywords to return the part of the url you want.
keyword | result |
---|---|
['http'] | Returns: http/https or None |
['www'] | Returns: www or None |
['sub_domain'] | Returns: sub-domain or None |
['domain'] | Returns: domain or None |
['top_domain'] | Returns: top-domain or None |
['dir'] | Returns: directory or None |
Usage with keywords
from url_parser import parse_url
parsed_url = parse_url('https://open.prospecta.app')
http = parsed_url['http']
sub_domain = parsed_url['sub_domain']
domain = parsed_url['domain']
top_domain = parsed_url['top_domain']
print(http)
>>> https://
print(sub_domain)
>>> open
print(domain)
>>> prospecta
print(top_domain)
>>> .app
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
url_parser-0.9.2.tar.gz
(1.9 kB
view hashes)
Built Distribution
Close
Hashes for url_parser-0.9.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 609c484ef6bb5df419c215e738fb20e7abf179a58f9aad791e08625ce913e6b8 |
|
MD5 | 469a634fe9c6e93f0f14c3126c745b24 |
|
BLAKE2b-256 | ebc82d943b1e31148ab0af623374ff0b2e3a1416e3a5f414f77bef708d261ac0 |