Skip to main content

Yet another URL library

Project description

yarl

https://travis-ci.org/aio-libs/yarl.svg?branch=master https://codecov.io/gh/aio-libs/yarl/branch/master/graph/badge.svg https://badge.fury.io/py/yarl.svg https://readthedocs.org/projects/yarl/badge/?version=latest

Introduction

Url is constructed from str:

>>> from yarl import URL
>>> url = URL('https://www.python.org/~guido?arg=1#frag')
>>> url
URL('https://www.python.org/~guido?arg=1#frag')

All url parts: scheme, user, passsword, host, port, path, query and fragment are accessible by properties:

>>> url.scheme
'https'
>>> url.host
'www.python.org'
>>> url.path
'/~guido'
>>> url.query_string
'arg=1'
>>> url.query
<MultiDictProxy('arg': '1')>
>>> url.fragment
'frag'

All url manipulations produces a new url object:

>>> url.parent / 'downloads/source'
URL('https://www.python.org/downloads/source')

Strings passed to constructor and modification methods are automatically encoded giving canonical representation as result:

>>> url = URL('https://www.python.org/путь')
>>> url
URL('https://www.python.org/%D0%BF%D1%83%D1%82%D1%8C')

Regular properties are percent-decoded, use raw_ versions for getting encoded strings:

>>> url.path
'/путь'

>>> url.raw_path
'/%D0%BF%D1%83%D1%82%D1%8C'

Human readable representation of URL is available as .human_repr():

>>> url.human_repr()
'https://www.python.org/путь'

For full documentation please read https://yarl.readthedocs.org.

Installation

$ pip install yarl

The library is Python 3 only!

Dependencies

YARL requires multidict library.

API documentation

The documentation is located at https://yarl.readthedocs.org

Comparison with other URL libraries

  • furl (https://pypi.python.org/pypi/furl)

    The libray has a rich functionality but furl object is mutable.

    I afraid to pass this object into foreign code: who knows if the code will modifiy my url in a terrible way while I just want to send URL with handy helpers for accessing URL properies.

    furl has other non obvious tricky things but the main objection is mutability.

  • URLObject (https://pypi.python.org/pypi/URLObject)

    URLObject is immutable, that’s pretty good.

    Every URL change generates a new URL object.

    But the library doesn’t any decode/encode transormations leaving end user to cope with these gory details.

Source code

The project is hosted on GitHub

Please file an issue on the bug tracker if you have found a bug or have some suggestion in order to improve the library.

The library uses Travis for Continuous Integration.

Discussion list

aio-libs google group: https://groups.google.com/forum/#!forum/aio-libs

Feel free to post your questions and ideas here.

Authors and License

The yarl package is written by Andrew Svetlov.

It’s Apache 2 licensed and freely available.

CHANGES

0.5.1 (2016-11-02)

  • Make URL counstruction faster by removing extra classmethod calls

0.5.0 (2016-11-02)

  • Add cython optimization for quoting/unquoting

  • Provide binary wheels

0.4.3 (2016-09-29)

  • Fix typing stubs

0.4.2 (2016-09-29)

  • Expose quote() and unquote() as public API

0.4.1 (2016-09-28)

  • Support empty values in query (‘/path?arg’)

0.4.0 (2016-09-27)

  • Introduce relative() #16

0.3.2 (2016-09-27)

  • Typo fixes #15

0.3.1 (2016-09-26)

  • Support sequience of pairs as with_query() parameter

0.3.0 (2016-09-26)

  • Introduce is_default_port()

0.2.1 (2016-09-26)

0.2.0 (2016-09-18)

  • Avoid doubling slashes when joining paths #13

  • Appending path starting from slash is forbidden #12

0.1.4 (2016-09-09)

  • Add kwargs support for with_query() #10

0.1.3 (2016-09-07)

  • Document with_query(), with_fragment() and origin()

  • Allow None for with_query() and with_fragment()

0.1.2 (2016-09-07)

  • Fix links, tune docs theme.

0.1.1 (2016-09-06)

  • Update REAMDE, old version used obsolete AIP

0.1.0 (2016-09-06)

  • The library was deeply refactored, bytes are gone away but all accepted strings are encoded if needed.

0.0.1 (2016-08-30)

  • The first release.

Project details


Release history Release notifications | RSS feed

This version

0.5.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yarl-0.5.1.tar.gz (115.5 kB view details)

Uploaded Source

Built Distributions

yarl-0.5.1-cp35-cp35m-win_amd64.whl (67.5 kB view details)

Uploaded CPython 3.5mWindows x86-64

yarl-0.5.1-cp35-cp35m-win32.whl (65.1 kB view details)

Uploaded CPython 3.5mWindows x86

yarl-0.5.1-cp35-cp35m-manylinux1_x86_64.whl (123.0 kB view details)

Uploaded CPython 3.5m

yarl-0.5.1-cp35-cp35m-manylinux1_i686.whl (117.8 kB view details)

Uploaded CPython 3.5m

yarl-0.5.1-cp34-cp34m-win_amd64.whl (66.4 kB view details)

Uploaded CPython 3.4mWindows x86-64

yarl-0.5.1-cp34-cp34m-win32.whl (65.0 kB view details)

Uploaded CPython 3.4mWindows x86

yarl-0.5.1-cp34-cp34m-manylinux1_x86_64.whl (124.9 kB view details)

Uploaded CPython 3.4m

yarl-0.5.1-cp34-cp34m-manylinux1_i686.whl (119.6 kB view details)

Uploaded CPython 3.4m

File details

Details for the file yarl-0.5.1.tar.gz.

File metadata

  • Download URL: yarl-0.5.1.tar.gz
  • Upload date:
  • Size: 115.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yarl-0.5.1.tar.gz
Algorithm Hash digest
SHA256 6cf502c91496d38dea2119cd2273fe0391f74be78f350c8a129268184fc1a3e9
MD5 d719ca7fb874c748deb6ae6342a36a68
BLAKE2b-256 de9f52a0a9f7bed6b2ef1ee8bece611230b98481dd241776e0b91193ab4366a1

See more details on using hashes here.

File details

Details for the file yarl-0.5.1-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for yarl-0.5.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 ff7be9d2227f0e12bd5581adf53690e20c730a5153cd815e60346702cc02731c
MD5 3e6ceb140cb1935d35b099cbf3657217
BLAKE2b-256 99e15d22b3921d12d6107d60e7ad5c008c887d9c15c4b5d8a7031fa0e3fa5955

See more details on using hashes here.

File details

Details for the file yarl-0.5.1-cp35-cp35m-win32.whl.

File metadata

  • Download URL: yarl-0.5.1-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 65.1 kB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yarl-0.5.1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 ac29d08c6e34c5fdc55dc97bfc5fbef68d23b0939f1e550a214860e03c93a202
MD5 6792fa0e31abb727ae3d6ba673c3bfc8
BLAKE2b-256 136dae0f6466fcdade9604afff081901c2c742ae2bc507e23eb7b3dbce8423f0

See more details on using hashes here.

File details

Details for the file yarl-0.5.1-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for yarl-0.5.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f2d329e4e357a6ea9318d536a68b1a68170bfeddf9e61c0bedc528472f1bba72
MD5 ed7408e08bede06171ac1e2241c6e1d3
BLAKE2b-256 39df2503ee9d6530cf66785f5aab24934b2be182a1ce0a5edb68e8dcb55593c9

See more details on using hashes here.

File details

Details for the file yarl-0.5.1-cp35-cp35m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for yarl-0.5.1-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 11b051599e4c90410588dbd1a76f5990776d5fc1b6d977fe7184314f6d2128c9
MD5 9b98d61af6b6df05b90bc8f244597852
BLAKE2b-256 fe0c0a76b977739f6208b71ed18535aae4b4199d6fafcade894b8a09698fd9f0

See more details on using hashes here.

File details

Details for the file yarl-0.5.1-cp34-cp34m-win_amd64.whl.

File metadata

File hashes

Hashes for yarl-0.5.1-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 4de7e1abecdb14625c20fe293f6f669e2e93ff1b9e56a95c0483b5bfb094a911
MD5 c646cffec1bfd16f34d0c5edcdbad58c
BLAKE2b-256 e0c3d46ce65eb81690869562478c8c0db75a61a378e061ea2b79b79da55778e8

See more details on using hashes here.

File details

Details for the file yarl-0.5.1-cp34-cp34m-win32.whl.

File metadata

  • Download URL: yarl-0.5.1-cp34-cp34m-win32.whl
  • Upload date:
  • Size: 65.0 kB
  • Tags: CPython 3.4m, Windows x86
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yarl-0.5.1-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 4326d5c816c15e04e10c0dfec43872c2384590974dd7f203b23a90011c2fd319
MD5 a5eaf5189fdf95d797c370e678ea7652
BLAKE2b-256 b3b38d14fbe65c011e788c354051d8ee5c95c473468a89a06cbb47faa370174a

See more details on using hashes here.

File details

Details for the file yarl-0.5.1-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for yarl-0.5.1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 db8cfebe4eba1c0b1b86405fa20b0d3efa19875645e8157695bd0d93b27d1967
MD5 0f9aa4709ed955c83ca16fab19969c7c
BLAKE2b-256 74e534ca68d32eff69dc6b2d1eb335bc96b9ae51da86bcf5426325c92f490c75

See more details on using hashes here.

File details

Details for the file yarl-0.5.1-cp34-cp34m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for yarl-0.5.1-cp34-cp34m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 8ea1f1ff41cb2e0d926c3b83a2940b6d0303386e3c5805747bd0d75600641a4d
MD5 6be00c6fc3f753989bd0a09dea0f3247
BLAKE2b-256 8df5b66c79a31130de452ac25529b7caef71eba416d8ef0e159c5d191b7dd6d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page