Metadata-Version: 2.1
Name: urlquote
Version: 1.0.0
Summary: Fast quoting and unquoting of urls.
Home-page: https://github.com/blue-yonder/urlquote
Author: Blue Yonder
Author-email: oss@blue-yonder.com
License: MIT
Platform: any
Requires-Dist: milksnake

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
-----

```python
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
------------

```bash
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`](https://crates.io/crates/percent-encoding) rust crate. It exposes part of its
functionality to python via a C-Interface using
[`milksnake`](https://github.com/getsentry/milksnake).

To build it you need to [install rust and cargo](https://www.rust-lang.org/en-US/install.html). You
can than proceed to build the wheel with:

```bash
python setup.py build sdist bdist_wheel
```

To execute the python tests use:

```bash
pip install -e .
pytest test.py
```

There are also some rust only unit tests. To execute them change into the `rust` subdirectory and
call.

```bash
cargo test
```

With the nightly toolchain installed you may also call the rust only benchmarks using:

```bash
cargo +nightly bench
```

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.

