murl: URL manipulation in Python, made simple¶
murl is a tiny wrapper for the Python module urlparse.
Source: | |
---|---|
Issues: | |
PyPI: | |
Build status: |
Usage¶
Creating a Url object¶
>>> from murl import Url
>>> url = Url('https://bugzilla.mozilla.org/show_bug.cgi?id=698201#c0')
>>> url
<Url: https://bugzilla.mozilla.org/show_bug.cgi?id=698201#c0>
Objects¶
- class Url(url[, **parts])¶
The url parameter should be a str object.
The parts dictionary should be one of them: scheme, netloc, path, params, query, fragment.
>>> url = murl.Url('http://www.google.com', path='about') >>> url <Url: http://www.google.com/about>
- url¶
- scheme¶
- host¶
- path¶
- port¶
New in version 0.5.
- querystring¶
- qs¶
Return a dict of the current querystring attribute. For example:
>>> url = Url('http://example.com/berkerpeksag?s=1&a=0&b=berker') >>> url.qs {'a': ['0'], 's': ['1'], 'b': ['berker']}
- fragment¶
- __repr__()¶
New in version 0.4.
Changelog¶
Hacking¶
To setup a local development environment for hacking:
Clone the repo:
$ git clone https://github.com/berkerpeksag/murl.git $ cd murl
Create and activate a new virtual environment:
$ python3.4 -m venv <your_venv_name> $ . <your_venv_name>/bin/activate
Install required dependencies:
$ pip install -r requirements-dev.txt
To run the tests, do:
$ nosetests
License¶
All files that are part of this project are covered by the following license, except where explicitly noted.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.