Registry / serialization / mdurl

mdurl

JSON →
library0.1.2pypypi✓ verified 52d ago

mdurl is a Python port of the JavaScript mdurl package, providing utilities for parsing, encoding, and decoding URLs in Markdown. The latest version is 0.1.2, released on August 14, 2022. The project has a stable release history with no recent updates.

serialization
pip install mdurl
Install & Compatibility
Where this runs
tested against v0.1.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.029s · 17.8MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 1.5s · import 0.023s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

encode
from mdurl import encode
import mdurl.encode
Incorrect import path; use direct import from mdurl.
decode
from mdurl import decode
import mdurl.decode
Incorrect import path; use direct import from mdurl.
parse
from mdurl import parse
import mdurl.parse
Incorrect import path; use direct import from mdurl.
format
from mdurl import format
import mdurl.format
Incorrect import path; use direct import from mdurl.

Demonstrates encoding, decoding, parsing, and formatting URLs using mdurl.

from mdurl import encode, decode, parse, format # Encode a URL encoded_url = encode('https://example.com/path?query=param') print(f'Encoded URL: {encoded_url}') # Decode a URL decoded_url = decode(encoded_url) print(f'Decoded URL: {decoded_url}') # Parse a URL parsed_url = parse('https://example.com/path?query=param') print(f'Parsed URL: {parsed_url}') # Format a parsed URL formatted_url = format(parsed_url) print(f'Formatted URL: {formatted_url}')
Debug
Known issues
gotchamdurl functions do not perform URL normalization; ensure input URLs are properly formatted.
fix
Manually normalize URLs before processing if necessary.
affects: All versions
gotchaInvalid percent-encoded sequences are left as-is during decoding.
fix
Validate URLs before decoding to handle invalid sequences appropriately.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'mdurl'
The 'mdurl' package is not installed in the Python environment where the code is being run.
fix
Install the package using pip: `pip install mdurl`
AttributeError: module 'mdurl' has no attribute 'quote'
The user is attempting to call a function that does not exist in the `mdurl` library, possibly confusing its API with other URL parsing libraries like `urllib.parse` or the original JavaScript `mdurl`.
fix
Refer to the `mdurl` documentation. The primary encoding function is `mdurl.encode()` and the decoding function is `mdurl.decode()`.
TypeError: argument 's' must be str, not int
The `mdurl.encode()` or `mdurl.decode()` function received an argument that is not a string, but an integer (or another non-string type) instead.
fix
Ensure that the input provided to `mdurl.encode()` or `mdurl.decode()` is a string.
ValueError: Malformed URL scheme
While `mdurl.parse()` is designed to be lenient, if the input URL string is severely malformed, particularly regarding its scheme or structure (e.g., `https:/example.com` instead of `https://example.com`), it can lead to unexpected parsing results or a `ValueError` if subsequent operations on the parsed object assume a valid structure.
fix
Validate and ensure that the URL string passed to `mdurl.parse()` or other functions has a reasonably well-formed structure, including the correct scheme (e.g., `http://`, `https://`).
Upgrade
Version history
0.1.2latest on PyPI
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
4
seranking-bot
4
ahrefsbot
2
Amazon
1
Resources