Metadata-Version: 1.1
Name: rfc3987
Version: 1.2.1
Summary: 
Parsing and validation of URIs (RFC 3896) and IRIs (RFC 3987)
Home-page: http://pypi.python.org/pypi/rfc3987
Author: Daniel Gerber
Author-email: UNKNOWN
License: UNKNOWN
Download-URL: https://github.com/dgerber/rfc3987
Description: This module provides regular expressions according to `RFC 3986`_ "Uniform 
        Resource Identifier (URI): Generic Syntax" and `RFC 3987`_ "Internationalized 
        Resource Identifiers (IRIs)", and utilities for composition and relative
        resolution:
        
        *patterns*
            A mapping of regular expressions keyed by `rule names for URIs`_ and 
            `for IRIs`_. ::
        
                >>> u = regex.compile('^%s$' % patterns['URI'])
                >>> m = u.match(u'http://tools.ietf.org/html/rfc3986#appendix-A')
                >>> assert m.groupdict() == dict(scheme=u'http',
                ...                              authority=u'tools.ietf.org',
                ...                              userinfo=None, host=u'tools.ietf.org',
                ...                              port=None, path=u'/html/rfc3986',
                ...                              query=None, fragment=u'appendix-A')
                >>> assert not u.match(u'urn:\U00010300')
                >>> assert regex.match('^%s$' % patterns['IRI'], u'urn:\U00010300')
                >>> assert not regex.match('^%s$' % patterns['relative_ref'], '#f#g')
        
        *compose*
            Returns an URI composed_ from named parts.
        
            .. _composed: http://tools.ietf.org/html/rfc3986#section-5.3
            
        
        *resolve*
            Resolves_ an `URI reference` relative to a `base` URI.
        
            If `return_parts` is True, returns a dict of named parts instead of
            a string.
            
            `Test cases <http://tools.ietf.org/html/rfc3986#section-5.4>`_::
            
                >>> base = "http://a/b/c/d;p?q"
                >>> for relative, resolved in {
                ...     "g:h"           :  "g:h",
                ...     "g"             :  "http://a/b/c/g",
                ...     "./g"           :  "http://a/b/c/g",
                ...     "g/"            :  "http://a/b/c/g/",
                ...     "/g"            :  "http://a/g",
                ...     "//g"           :  "http://g",
                ...     "?y"            :  "http://a/b/c/d;p?y",
                ...     "g?y"           :  "http://a/b/c/g?y",
                ...     "#s"            :  "http://a/b/c/d;p?q#s",
                ...     "g#s"           :  "http://a/b/c/g#s",
                ...     "g?y#s"         :  "http://a/b/c/g?y#s",
                ...     ";x"            :  "http://a/b/c/;x",
                ...     "g;x"           :  "http://a/b/c/g;x",
                ...     "g;x?y#s"       :  "http://a/b/c/g;x?y#s",
                ...     ""              :  "http://a/b/c/d;p?q",
                ...     "."             :  "http://a/b/c/",
                ...     "./"            :  "http://a/b/c/",
                ...     ".."            :  "http://a/b/",
                ...     "../"           :  "http://a/b/",
                ...     "../g"          :  "http://a/b/g",
                ...     "../.."         :  "http://a/",
                ...     "../../"        :  "http://a/",
                ...     "../../g"       :  "http://a/g",
                ...     "../../../g"    :  "http://a/g",
                ...     "../../../../g" :  "http://a/g",
                ...     "/./g"          :  "http://a/g",
                ...     "/../g"         :  "http://a/g",
                ...     "g."            :  "http://a/b/c/g.",
                ...     ".g"            :  "http://a/b/c/.g",
                ...     "g.."           :  "http://a/b/c/g..",
                ...     "..g"           :  "http://a/b/c/..g",
                ...     "./../g"        :  "http://a/b/g",
                ...     "./g/."         :  "http://a/b/c/g/",
                ...     "g/./h"         :  "http://a/b/c/g/h",
                ...     "g/../h"        :  "http://a/b/c/h",
                ...     "g;x=1/./y"     :  "http://a/b/c/g;x=1/y",
                ...     "g;x=1/../y"    :  "http://a/b/c/y",
                ...     }.iteritems():
                ...     assert resolve(base, relative) == resolved
        
                
            .. _Resolves: http://tools.ietf.org/html/rfc3986#section-5.2
        
            
        
        
        .. _RFC 3986: http://tools.ietf.org/html/rfc3986
        .. _RFC 3987: http://tools.ietf.org/html/rfc3987
        .. _rule names for URIs: http://tools.ietf.org/html/rfc3986#appendix-A
        .. _for IRIs: http://tools.ietf.org/html/rfc3987#section-2.2
        
        
Keywords: URI IRI URL rfc3986 rfc3987 validation
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet
Requires: regex
