Skip to main content

Welcome to urlclean’s documentation!

urlclean provides functions:

  • to follow a http redirect,

  • to follow a HTML META redirect,

  • to remove Urchin and Facebook tracker URL parameters,

  • plugins for futher cleaning power,

  • combines all these to unshorten and resolve various URLS

Try it out from the commandline:

python -m urlclean <some url>

Contents:

Indices and tables

  • Index

  • Module Index

  • Search Page

Documentation for the Code

urlcleaner a module that resolves redirected urls and removes tracking url params

urlclean.weedparams(url)

removes Urchin Tracker and Facebook surveillance params from urls.

Args:

url (str): The url to scrub of ugly params

Returns:

(str). The return cleaned url

urlclean.httpresolve(url, ua=None, proxyhost=’’, proxyport=’’)

resolve one redirection of a http request.

Args:

url (str): The url to follow one redirect

ua (fn): A function returning a User Agent string (optional)

proxyhost (str): http proxy server (optional)

proxyport (int): http proxy server port (optional)

Returns: (str, httplib.response). The return resolved url, and

the response from the http query

urlclean.unmeta(url, res)

Finds any meta redirects a httplib.response object that has text/html as content-type.

Args:

url (str): The url to follow one redirect

res (httplib.response): a http.response object

Returns: (str). The return resolved url

urlclean.unshorten(url, cache=None, ua=None, >>**<<kwargs)

resolves all HTTP/META redirects and optionally caches them in any object supporting a __getitem__, __setitem__ interface

Args:

url (str): The url to follow one redirect

cache (PersistentCryptoDict): an optional PersistentCryptoDict instance

ua (fn): A function returning a User Agent string (optional), the default is googlebot.

>>**<<kwargs (dict): optional proxy args for urlclean.httpresolve (default: localhost:8118)

Returns: (str). The return final cleaned url.

Plugins

Plugins should have a convert function that receives and returns a URL. In case of an error an unchanged URL should be returned.

Changelog

  • v0.5.4 - fixed httpresolve for relative urls

  • v0.5.1 - install/doc fixes

  • v0.5 - added plugins

Metadata

Release files for urlclean 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for urlclean 0.5.4
File Size Uploaded Provenance
urlclean-0.5.4.tar.gz 5.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for urlclean 0.5.4
File Interpreter ABI Platform
urlclean-0.5.4-py2.7.egg Legacy Egg format - - Details

Total release size: 17.5 kB

Release files / urlclean-0.5.4.tar.gz

Download URL urlclean-0.5.4.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a32d85e709acbd918c6487dad8fd793c14eaa680ea2cacd9d06f1e52ab13b96c
BLAKE2b-256 checksum
How to use checksums
a25c479e3bcae6984bd1bbedfaa1a0b354d1991b9f3ff5ff75e8aaf3a5d09eca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / urlclean-0.5.4-py2.7.egg

Download URL urlclean-0.5.4-py2.7.egg
Size 11.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
f134a3d1b10423f873429fa5817d3e71cff2d0fd00bc46f4ddfc6c656e1b057b
BLAKE2b-256 checksum
How to use checksums
7003b8e3aaff4b09f201a89c1b07bff6d869d0769ab8735e03e48f4b6540814d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for urlclean 0.5.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page