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

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.0b5.tar.gz (115.5 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.5m Windows x86-64

yarl-0.5.0b5-cp35-cp35m-win32.whl (65.0 kB view details)

Uploaded CPython 3.5m Windows x86

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

Uploaded CPython 3.5m

yarl-0.5.0b5-cp35-cp35m-manylinux1_i686.whl (117.7 kB view details)

Uploaded CPython 3.5m

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

Uploaded CPython 3.4m Windows x86-64

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

Uploaded CPython 3.4m Windows x86

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

Uploaded CPython 3.4m

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

Uploaded CPython 3.4m

File details

Details for the file yarl-0.5.0b5.tar.gz.

File metadata

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

File hashes

Hashes for yarl-0.5.0b5.tar.gz
Algorithm Hash digest
SHA256 667b1384b85880f880b6d637a7878ecd711564a372d735f11f09ad197f5557ff
MD5 2b2d7dd1b768f873c3100bf971253a32
BLAKE2b-256 856f27311b7e8f1df2a652fdf5111da74e5b48cb5243fbebfb9607f0e9840522

See more details on using hashes here.

File details

Details for the file yarl-0.5.0b5-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for yarl-0.5.0b5-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 318c01ae7d874d374e5149745b52c8039b506f4e42ad19780475c5affb2ebf8f
MD5 b57781221406547a0ace3f8685088133
BLAKE2b-256 d242f606a00fab69386b6c87f8b91cb66e3fc7d37a6ea34d11c75d5a23c428f8

See more details on using hashes here.

File details

Details for the file yarl-0.5.0b5-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for yarl-0.5.0b5-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 f1035b7a035e60a1cd0b8379f352ee80f277ee209cf28b8417546326638d6416
MD5 82973604478e0d70e08f92c6b334ae42
BLAKE2b-256 2f0cdc77b3e33535bc08dc30bee025f9c8c36cb0b8379d29bbf6a9632063139d

See more details on using hashes here.

File details

Details for the file yarl-0.5.0b5-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for yarl-0.5.0b5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 46c140a9e3d9548509ff49b00fe979e4ed3e4991ef6104618614bd5ca8ec41a5
MD5 5819f7a532de24cc308a7be2a45e31d6
BLAKE2b-256 3138f0a58a5118de87707d80ec967695ec3975247ee121640436434b411769f0

See more details on using hashes here.

File details

Details for the file yarl-0.5.0b5-cp35-cp35m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for yarl-0.5.0b5-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 142f6af465d14f6be7955458b2093641502a71279afd00d2da1b6e7194c20e49
MD5 26909595353d36237d3aaca147c9edb2
BLAKE2b-256 46d691d1e4ff633eb1bedc591f6d614cc07da6ba3c5aaa5c4f2a1e4e2c2ea9a4

See more details on using hashes here.

File details

Details for the file yarl-0.5.0b5-cp34-cp34m-win_amd64.whl.

File metadata

File hashes

Hashes for yarl-0.5.0b5-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 1df3048bf73c7252416ea5d0d37c088a2436355857c08b38b372c28b28172b73
MD5 2935a505b4d5cddb3e4814b705a71dc6
BLAKE2b-256 9ca6300dff6b0666671b1e07d9f0cfefb72b4adf23a53e063ccfc903ad056fe8

See more details on using hashes here.

File details

Details for the file yarl-0.5.0b5-cp34-cp34m-win32.whl.

File metadata

File hashes

Hashes for yarl-0.5.0b5-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 fed3fd171c534aed0f656445a8339786a16cee803e9d337904effbe62b761b89
MD5 bd9b5f2320ecb9658a4a3d5aded428e3
BLAKE2b-256 774641c8c55ab208085a0543931cd0c8e7849b0c7cf92550949d864b73db1aa5

See more details on using hashes here.

File details

Details for the file yarl-0.5.0b5-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for yarl-0.5.0b5-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 604e7f76d0164bd9a7ba3e30f22f6ad28a07947952eb35e1fbaab6c3bf1e4125
MD5 9e57b354c4d157e4b2784757d93298e1
BLAKE2b-256 0e981bf26c9eb5a7d1d1a8e6465be3bd7159c983d3c6e099537d0ab390b13c85

See more details on using hashes here.

File details

Details for the file yarl-0.5.0b5-cp34-cp34m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for yarl-0.5.0b5-cp34-cp34m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 e238b38cf02233a5b88ebdacf06e66903e464308b411fdad7f0cf74d2fc5d7b1
MD5 be39520871e48a84ed961b3dfbd7a8dc
BLAKE2b-256 93408f710562c9fce8b382b6853b9b0dd0ff1bd505521348ff45ec2cb0663673

See more details on using hashes here.

Supported by

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