Python URL manipulation made simple.
github.com
github.com
>>> furl('http://www.example.com?foo=1&foo=2')
furl('http://www.example.com?foo=1')
See Werkzeug's MultiDict for one way to handle this correctly. https://github.com/gruns/furl/blob/master/furl.py#L142
Werkzeug's MultiDict looks like a good combination for the best of both worlds, ease of use and flexibility. Thanks for the reference.For example, Django do it wrong (even though I tried: https://code.djangoproject.com/ticket/11522):
>>> print(django.VERSION)
(1, 3, 1, 'final', 0)
>>> print(django.http.HttpResponseRedirect(u"http://müller.de))
Content-Type: text/html; charset=utf-8
Location: http://m%C3%BCller.de
While werkzeug is good! >>> print(werkzeug.__version__)
0.8.1
>>> werkzeug.redirect(u"http://müller.de).headers
Headers([('Content-Type', 'text/html; charset=utf-8'),
('Content-Length', '247'),
('Location', 'http://xn--mller-kva.de)]I built a template library for Django on top of it: https://github.com/j4mie/django-spurl
Edit: Does anyone have more information on the license? I do plan to build amazing things, but it would be nice to know under what conditions I can release those amazing things to the public. I assume it means no restrictions, but I'd hate to go stepping on someone's toes.
E.g. a page giving an overview of BSD, GPLv2, GPLv3, LGPL, the Creative Commons bunch (no idea if they are usable for source code). Basically I'm wondering if there's a "Intro to licensing your crap on github" post somewhere on the net...
I was motivated to write it in response to one of Quora's Programming Challenges (http://www.quora.com/about/challenges). It seemed like a fun problem, and I had never had a good reason to read through the applicable RFCs. I wonder if furl was similarly motivated?
I don't find the standard library modules very difficult to use, however, so I haven't spent much more time on it since then.
https://github.com/bsandrow/uriliblet's merge some code!