<commit_before>:mod:`urlparse` --- Parse URLs into components
==============================================

.. module:: urlparse
   :synopsis: Parse URLs into or assemble them from components.


.. index::
   single: WWW
   single: World Wide Web
   single: URL
   pair: URL; parsing
   pair: relative; URL

.. note::
   The :mod:`urlparse` module is renamed to :mod:`urllib.parse` in Python 3.
   The :term:`2to3` tool will automatically adapt imports when converting
   your sources to Python 3.

**Source code:** :source:`Lib/urlparse.py`

--------------

This module defines a standard interface to break Uniform Resource Locator (URL)
strings up in components (addressing scheme, network location, path etc.), to
combine the components back into a URL string, and to convert a "relative URL"
to an absolute URL given a "base URL."

The module has been designed to match the Internet RFC on Relative Uniform
Resource Locators (and discovered a bug in an earlier draft!). It supports the
following URL schemes: ``file``, ``ftp``, ``gopher``, ``hdl``, ``http``,
``https``, ``imap``, ``mailto``, ``mms``, ``news``,  ``nntp``, ``prospero``,
``rsync``, ``rtsp``, ``rtspu``,  ``sftp``, ``shttp``, ``sip``, ``sips``,
``snews``, ``svn``,  ``svn+ssh``, ``telnet``, ``wais``.

.. versionadded:: 2.5
   Support for the ``sftp`` and ``sips`` schemes.

The :mod:`urlparse` module defines the following functions:


.. function:: urlparse(urlstring[, scheme[, allow_fragments]])

   Parse a URL into six components, returning a 6-tuple.  This corresponds to the
   general structure of a URL: ``scheme://netloc/path;parameters?query#fragment``.
   Each tuple item is a string, possibly empty. The components are not broken up in
   smaller parts (for example, the network location is a single string), and %
   escapes are not expanded. The delimiters as shown above are not part of the
   result, except for a leading slash in the *path* component, which is retained if
   present.  For example:

      >>> from urlparse import urlparse
      >>> o = urlparse('http://www.cwi.nl:80/%7Eguido/Python.html')<commit_msg>urlparse docs clean up<commit_after>:mod:`urlparse` --- Parse URLs into components
==============================================

.. module:: urlparse
   :synopsis: Parse URLs into or assemble them from components.


.. index::
   single: WWW
   single: World Wide Web
   single: URL
   pair: URL; parsing
   pair: relative; URL

.. note::
   The :mod:`urlparse` module is renamed to :mod:`urllib.parse` in Python 3.
   The :term:`2to3` tool will automatically adapt imports when converting
   your sources to Python 3.

**Source code:** :source:`Lib/urlparse.py`

--------------

This module defines a standard interface to break Uniform Resource Locator (URL)
strings up in components (addressing scheme, network location, path etc.), to
combine the components back into a URL string, and to convert a "relative URL"
to an absolute URL given a "base URL."

The module has been designed to match the Internet RFC on Relative Uniform
Resource Locators. It supports the following URL schemes: ``file``, ``ftp``,
``gopher``, ``hdl``, ``http``, ``https``, ``imap``, ``mailto``, ``mms``,
``news``,  ``nntp``, ``prospero``, ``rsync``, ``rtsp``, ``rtspu``,  ``sftp``,
``shttp``, ``sip``, ``sips``, ``snews``, ``svn``,  ``svn+ssh``, ``telnet``,
``wais``.

.. versionadded:: 2.5
   Support for the ``sftp`` and ``sips`` schemes.

The :mod:`urlparse` module defines the following functions:


.. function:: urlparse(urlstring[, scheme[, allow_fragments]])

   Parse a URL into six components, returning a 6-tuple.  This corresponds to the
   general structure of a URL: ``scheme://netloc/path;parameters?query#fragment``.
   Each tuple item is a string, possibly empty. The components are not broken up in
   smaller parts (for example, the network location is a single string), and %
   escapes are not expanded. The delimiters as shown above are not part of the
   result, except for a leading slash in the *path* component, which is retained if
   present.  For example:

      >>> from urlparse import urlparse
      >>> o = urlparse('http://www.cwi.nl:80/%7Eguido/Python.html')
{'fraction_non_alphanumeric': 0.1618455653836959, 'fraction_numerical': 0.0047812574707147976, 'mean_word_length': 4.152709359605911, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2848616', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1209, 'n_words': 514}