Python - Our key to Efficiency

mxURL - An URL datatype


Interface ( Functions : Objects : Constants ) : Examples : Structure : Support : Download : Copyright & License : History : Home Version 0.2.0

Introduction

    This package provides a new datatype for storing and manipulating URL values as well as a few helpers related to URL building, encoding and decoding.

    The main intention of the package is to provide an easy to use, fast and lightwheight datatype for Universal Resource Locators (note the W3C now calls these URIs).

Interface

Examples of Use

    Here is a very simple one:

    from mx.URL import *
    url = URL('http://search.python.org/query.html?qt=mx')
    print url.scheme
    >>> http
    print url.host  
    >>> search.python.org
    print url.query
    >>> qt=mx
    print url.path
    >>> /query.html
    

    More examples will eventually appear in the Examples subdirectory of the package.

Package Structure

    [URL]
           Doc/
           [mxURL]
           URL.py
    	

    Entries enclosed in brackets are packages (i.e. they are directories that include a __init__.py file). Ones without brackets are just simple subdirectories that are not accessible via import.

    The package imports all symbols from the extension module, so you only need to 'from mx import URL' to start working.

Support

What I'd like to hear from you...

    • Comments, ideas, bug-fixes :-)

Copyright & License

History & Future

    Things that still need to be done:

    • Provide some more examples.

    • Update to RFC 2396 (URI).

    • Make .relative() work with relative URLs. Suggested by Walter Dörwald.

    • Disable attributes for schemes where these make no sense (e.g. javascript:). Suggested by Walter Dörwald.

    • Make subclassable when used with Python 2.2 and later.

    • URL('http://amk.ca#foo') doesn't work properly; it parses the '#foo' into the hostname.

    Changes from 0.1.0 to 0.2.0:

    • Added support to inherit queries and parameters when joining with empty URLs or URLs which only contain a fragment. This enhances compatibility to URI (RFC 2396).

    • Added more tests to test.py.

    • Added note about the URL constructors raising errors when finding unknown URL schemes.

    Version 0.1.0 was the intial release.


© 1998-2000, Copyright by Marc-André Lemburg; All Rights Reserved. mailto: mal@lemburg.com

© 2000-2001, Copyright by eGenix.com Software GmbH; All Rights Reserved. mailto: info@egenix.com