Skip to main content

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


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.3.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

url_parser-0.9.3-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file url_parser-0.9.3.tar.gz.

File metadata

  • Download URL: url_parser-0.9.3.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.2

File hashes

Hashes for url_parser-0.9.3.tar.gz
Algorithm Hash digest
SHA256 1abe2eff4098d0162925a83b8e75a2c3fcf2e66523a589f99f7942eb1222cf6b
MD5 d8ab745e2d9d64b02818504b03a38602
BLAKE2b-256 26172e5e5002ea2a7df11fe828d25cd2477704e47b953767d657f4da85bb25ca

See more details on using hashes here.

File details

Details for the file url_parser-0.9.3-py3-none-any.whl.

File metadata

  • Download URL: url_parser-0.9.3-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.2

File hashes

Hashes for url_parser-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 858194f3fb00ab111c7171298bdacd833689e75c87549bf3939c637442131e8a
MD5 c51c370826c619bf06274fef2fd90045
BLAKE2b-256 856291ec18f7296c032a6ae668cb2a925411d1e57d40948cdf3ba3bce41eac9f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page