hostparse
hostparse - A command-line client for URL and hostname swizzling
Installation
hostparse can be installed manually by cloning this repository, going to the main directory and typing:
pip install .
Or it can be installed using PyPI:
pip install hostparse
Usage
hostparse installs as a commandline utility and takes input from stdin. In essence hostparse has a few simple parseable items it can extract from a URL. This is the full list of items:
- scheme
- username
- password
- subdomain
- domain
- hostname
- tld
- port
- path
- params
- query
- fragment
These items can be used as 'swizzling' operators seperated by a comma (,). For example, lets say the input contains a url from which you want to extract just the registered domain with its tld you can do:
hostparse domain,tld
Now what is neat with these items is that the tool will match the shortest match without duplicates. This means that instead of typing tld you can also type tl or even t as there are no other items that would conflict. The same query as before can also be written as:
hostparse d,t
The only thing to be careful of is the match, for example you can't use p for port as it will also match other items (the tool will warn you about this and simply return without processing data). You have to get the right match, po will work for ports however pa won't work woth path as it will also match params which means you have to use pat for path.
Additionally the data the tool outputs uses a delimiter based on the items you choose, so if you choose domain and tld it will be outputed as: <domain>.<tld>. You can change this delimiter value with the -d operator after you specify the items to filter out. If you don't want a delimiter you can specify it as -d''.
One extra thing to point out: the order of the items you specify is also how they are represented in the output.
Bugs & Features
Feel free to open issues for features or bugs you've found or do a pull request and you will be rewarded somewhere later in life for it.
Metadata
Release files for hostparse 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hostparse-0.0.6.tar.gz | 3.8 kB | Without provenance | Details for hostparse-0.0.6.tar.gz |
Release files / hostparse-0.0.6.tar.gz
| Download URL | hostparse-0.0.6.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8f6c4b67aee2b9d9bf9c371f2e76a43b37f1c2a0dd0f1c41b44323ad55a0181
|
|
BLAKE2b-256 checksum How to use checksums |
b8ca4fdc9cd3eb02061a075d1400b31108d2b83c52cc813e0ead616febc0316b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
|
Security for hostparse 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.