Fast quoting and unquoting of urls.
Project description
Urlquote
Fast percent encoding / decoding for python.
This library is not intended to be a replacement for urllib. urllib
is part of the python
standard library and should be your goto choice to quote and unquote URLs. However, should quoting
/ unquoting URLs be known to be a performance bottleneck and you are fine with the encoding
described below, then by all means have fun using this library.
Usage
from urlquote import quote
quoted = quote('/El Niño/')
assert(quoted == '/El%20Ni%C3%B1o/'.encode('utf-8'))
Compatibility
Since this library uses a cffi
interface it should work fine with any python version. For linux
the wheel has to be build against a libc with a version older or equal to the version of libc on the
platform the wheel will be executed on.
Installation
pip install urlquote
quote
operates utf-8 encoded bytes. If passed a string, it will enocde it into utf-8 first. It
will always return utf-8
encoded bytes. unquote
behaves the same way.
Encoding
All ASCII characters less than hexidecimal 20 and greater than 7E are encoded. This includes special charcters such as line feed, carriage return, NULL, etc. . Aside from these, space, double quote (") , hash (#), inequality qualifiers (<), (>), backtick (`), question mark (?), and curly brackets ({), (}) are also encoded.
Development
This library is a thin wrapper around the
percent-encoding
rust crate. It exposes part of its
functionality to python via a C-Interface using
milksnake
.
Support
This tool is provided as is under an MIT license without any warranty or SLA. You are free to use it as part for any purpose, but the responsibility for operating it resides with you. We appreciate your feedback though. Contributions on GitHub are welcome.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file urlquote-0.1.8.tar.gz
.
File metadata
- Download URL: urlquote-0.1.8.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e6d8b851c3f2935b31f851a2e3e281947351ac8d5c38fadd64c6aad3fd4aa5b |
|
MD5 | 210e43a96118218907a52617b6a93584 |
|
BLAKE2b-256 | 5c333b71f0e778a2bdd026e9ddde0219cbb7376374a30155aa5dbaab19fb3afc |