Skip to content

Yarl

Yet another URL library

Introduction

URL is constructed from str:

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

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

url.scheme
url.host
url.path
url.query_string
url.query
url.fragment

All URL manipulations produces a new URL object:

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

See also

Favorite site