domain-utils

A collection of util functions for extracting domains from urls.


Keywords
domain_utils
License
MPL-2.0
Install
pip install domain-utils==0.7.1

Documentation

domain_utils

CircleCI Documentation Status

A collection of util functions for extracting domains from urls.

Repo: https://github.com/mozilla/domain_utils

Install:

pip install domain_utils

Use:

import domain_utils as du
# Return just the url `my.domain.cloudfront.net/a/path/to/a/file.html`
du.stem_url('https://my.domain.cloudfront.net/a/path/to/a/file.html?a=1')
# Return just the eTLD+1 `domain.cloudfront.net`
du.get_etld1('https://my.domain.cloudfront.net/a/path/to/a/file.html?a=1')
# Get the port `5000`
du.get_port('https://localhost:5000/a/path/to/a/file.html?a=1')
# Get the scheme `wss`
du.get_scheme('wss://somedomain.example.com/a/path/to/a/ws')

This package was originally extracted from openwpm-utils.

Community Participation Guidelines

This project is governed by Mozilla's code of conduct and etiquette guidelines.

For more details, please read the Mozilla Community Participation Guidelines.

For more information on how to report violations of the Community Participation Guidelines, please read our How to Report page.