<commit_before>:mod:`urllib2` --- extensible library for opening URLs
======================================================

.. module:: urllib2
   :synopsis: Next generation URL opening library.
.. moduleauthor:: <NAME> <<EMAIL>>
.. sectionauthor:: <NAME> <<EMAIL>>


.. note::
   The :mod:`urllib2` module has been split across several modules in
   Python 3.0 named :mod:`urllib.request` and :mod:`urllib.error`.
   The :term:`2to3` tool will automatically adapt imports when converting
   your sources to 3.0.


The :mod:`urllib2` module defines functions and classes which help in opening
URLs (mostly HTTP) in a complex world --- basic and digest authentication,
redirections, cookies and more.

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


.. function:: urlopen(url[, data][, timeout])

   Open the URL *url*, which can be either a string or a :class:`Request` object.

   *data* may be a string specifying additional data to send to the server, or
   ``None`` if no such data is needed.  Currently HTTP requests are the only ones
   that use *data*; the HTTP request will be a POST instead of a GET when the
   *data* parameter is provided.  *data* should be a buffer in the standard
   :mimetype:`application/x-www-form-urlencoded` format.  The
   :func:`urllib.urlencode` function takes a mapping or sequence of 2-tuples and
   returns a string in this format.

   The optional *timeout* parameter specifies a timeout in seconds for blocking
   operations like the connection attempt (if not specified, the global default
   timeout setting will be used).  This actually only works for HTTP, HTTPS,
   FTP and FTPS connections.

   This function returns a file-like object with two additional methods:

   * :meth:`geturl` --- return the URL of the resource retrieved, commonly used to
     determine if a redirect was followed

   * :meth:`info` --- return the meta-information of the page, such as headers, in
     the form of an ``httplib.HTTPMessage`` instance
     (see `Quick Reference to HTTP Headers <http://www.cs.tut.fi/~jkorpela/http.html>`_)

   Raises :exc:`URLError` on errors.

   Note that ``None`` may be returned if no handler handles the request (though the
   default installed global :class:`OpenerDirector` uses :class:`UnknownHandler` to
   ensure this never happens).

   In addition, default installed :class:`ProxyHandler` makes sure the requests
   are handled through the proxy when they are set.
<commit_msg>Documentation correction. urllib2.urlopen.info returns a mimetools.Message instance not HTTPMessage object.<commit_after>:mod:`urllib2` --- extensible library for opening URLs
======================================================

.. module:: urllib2
   :synopsis: Next generation URL opening library.
.. moduleauthor:: <NAME> <<EMAIL>>
.. sectionauthor:: <NAME> <<EMAIL>>


.. note::
   The :mod:`urllib2` module has been split across several modules in
   Python 3.0 named :mod:`urllib.request` and :mod:`urllib.error`.
   The :term:`2to3` tool will automatically adapt imports when converting
   your sources to 3.0.


The :mod:`urllib2` module defines functions and classes which help in opening
URLs (mostly HTTP) in a complex world --- basic and digest authentication,
redirections, cookies and more.

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


.. function:: urlopen(url[, data][, timeout])

   Open the URL *url*, which can be either a string or a :class:`Request` object.

   *data* may be a string specifying additional data to send to the server, or
   ``None`` if no such data is needed.  Currently HTTP requests are the only ones
   that use *data*; the HTTP request will be a POST instead of a GET when the
   *data* parameter is provided.  *data* should be a buffer in the standard
   :mimetype:`application/x-www-form-urlencoded` format.  The
   :func:`urllib.urlencode` function takes a mapping or sequence of 2-tuples and
   returns a string in this format.

   The optional *timeout* parameter specifies a timeout in seconds for blocking
   operations like the connection attempt (if not specified, the global default
   timeout setting will be used).  This actually only works for HTTP, HTTPS,
   FTP and FTPS connections.

   This function returns a file-like object with two additional methods:

   * :meth:`geturl` --- return the URL of the resource retrieved, commonly used to
     determine if a redirect was followed

   * :meth:`info` --- return the meta-information of the page, such as headers,
     in the form of an :class:`mimetools.Message` instance
     (see `Quick Reference to HTTP Headers <http://www.cs.tut.fi/~jkorpela/http.html>`_)

   Raises :exc:`URLError` on errors.

   Note that ``None`` may be returned if no handler handles the request (though the
   default installed global :class:`OpenerDirector` uses :class:`UnknownHandler` to
   ensure this never happens).

   In addition, default installed :class:`ProxyHandler` makes sure the requests
   are handled through the proxy when they are set.

{'fraction_non_alphanumeric': 0.10606965174129353, 'fraction_numerical': 0.004975124378109453, 'mean_word_length': 4.000995024875622, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2936169', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1311, 'n_words': 633}