PageRenderTime 66ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/html/library/urllib.error.html

https://bitbucket.org/andrikmb/py3k-doc
HTML | 177 lines | 162 code | 15 blank | 0 comment | 0 complexity | 7cf5fc36fbfe2bb17a5f0856ea10a3df MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>20.8. urllib.error Exception classes raised by urllib.request &mdash; Documentação Python v3.1c1</title>
  7. <link rel="stylesheet" href="../_static/default.css" type="text/css" />
  8. <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '../',
  12. VERSION: '3.1c1',
  13. COLLAPSE_MODINDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="../_static/jquery.js"></script>
  19. <script type="text/javascript" src="../_static/doctools.js"></script>
  20. <link rel="search" type="application/opensearchdescription+xml"
  21. title="Search within Documentação Python v3.1c1"
  22. href="../_static/opensearch.xml"/>
  23. <link rel="author" title="About these documents" href="../about.html" />
  24. <link rel="copyright" title="Copyright" href="../copyright.html" />
  25. <link rel="top" title="Documentação Python v3.1c1" href="../index.html" />
  26. <link rel="up" title="20. Internet Protocols and Support" href="internet.html" />
  27. <link rel="next" title="20.9. urllib.robotparser — Parser for robots.txt" href="urllib.robotparser.html" />
  28. <link rel="prev" title="20.7. urllib.parse — Parse URLs into components" href="urllib.parse.html" />
  29. <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
  30. </head>
  31. <body>
  32. <div class="related">
  33. <h3>Navigation</h3>
  34. <ul>
  35. <li class="right" style="margin-right: 10px">
  36. <a href="../genindex.html" title="Índice Geral"
  37. accesskey="I">&iacute;ndice</a></li>
  38. <li class="right" >
  39. <a href="../modindex.html" title="Índice Global de Móodulos"
  40. accesskey="M">m&oacute;dulos</a> |</li>
  41. <li class="right" >
  42. <a href="urllib.robotparser.html" title="20.9. urllib.robotparser — Parser for robots.txt"
  43. accesskey="N">pr&oacute;ximo</a> |</li>
  44. <li class="right" >
  45. <a href="urllib.parse.html" title="20.7. urllib.parse — Parse URLs into components"
  46. accesskey="P">anterior</a> |</li>
  47. <li><img src="../_static/py.png" alt=""
  48. style="vertical-align: middle; margin-top: -1px"/></li>
  49. <li><a href="../index.html">Documentação Python v3.1c1</a> &raquo;</li>
  50. <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
  51. <li><a href="internet.html" accesskey="U">20. Internet Protocols and Support</a> &raquo;</li>
  52. </ul>
  53. </div>
  54. <div class="document">
  55. <div class="documentwrapper">
  56. <div class="bodywrapper">
  57. <div class="body">
  58. <div class="section" id="module-urllib.error">
  59. <h1>20.8. <tt class="xref docutils literal"><span class="pre">urllib.error</span></tt> &#8212; Exception classes raised by urllib.request<a class="headerlink" href="#module-urllib.error" title="Permalink to this headline"></a></h1>
  60. <p>The <tt class="xref docutils literal"><span class="pre">urllib.error</span></tt> module defines the exception classes for exceptions
  61. raised by <a title="Next generation URL opening library." class="reference external" href="urllib.request.html#module-urllib.request"><tt class="xref docutils literal"><span class="pre">urllib.request</span></tt></a>. The base exception class is <a title="urllib.error.URLError" class="reference internal" href="#urllib.error.URLError"><tt class="xref docutils literal"><span class="pre">URLError</span></tt></a>,
  62. which inherits from <a title="exceptions.IOError" class="reference external" href="exceptions.html#exceptions.IOError"><tt class="xref docutils literal"><span class="pre">IOError</span></tt></a>.</p>
  63. <p>The following exceptions are raised by <tt class="xref docutils literal"><span class="pre">urllib.error</span></tt> as appropriate:</p>
  64. <dl class="exception">
  65. <dt id="urllib.error.URLError">
  66. <em class="property">
  67. exception </em><tt class="descclassname">urllib.error.</tt><tt class="descname">URLError</tt><a class="headerlink" href="#urllib.error.URLError" title="Link permanente para esta defini&ccedil;&atilde;o"></a></dt>
  68. <dd><p>The handlers raise this exception (or derived exceptions) when they run into
  69. a problem. It is a subclass of <a title="exceptions.IOError" class="reference external" href="exceptions.html#exceptions.IOError"><tt class="xref docutils literal"><span class="pre">IOError</span></tt></a>.</p>
  70. <dl class="attribute">
  71. <dt id="urllib.error.URLError.reason">
  72. <tt class="descname">reason</tt><a class="headerlink" href="#urllib.error.URLError.reason" title="Link permanente para esta defini&ccedil;&atilde;o"></a></dt>
  73. <dd>The reason for this error. It can be a message string or another
  74. exception instance (<a title="socket.error" class="reference external" href="socket.html#socket.error"><tt class="xref docutils literal"><span class="pre">socket.error</span></tt></a> for remote URLs, <a title="exceptions.OSError" class="reference external" href="exceptions.html#exceptions.OSError"><tt class="xref docutils literal"><span class="pre">OSError</span></tt></a>
  75. for local URLs).</dd></dl>
  76. </dd></dl>
  77. <dl class="exception">
  78. <dt id="urllib.error.HTTPError">
  79. <em class="property">
  80. exception </em><tt class="descclassname">urllib.error.</tt><tt class="descname">HTTPError</tt><a class="headerlink" href="#urllib.error.HTTPError" title="Link permanente para esta defini&ccedil;&atilde;o"></a></dt>
  81. <dd><p>Though being an exception (a subclass of <a title="urllib.error.URLError" class="reference internal" href="#urllib.error.URLError"><tt class="xref docutils literal"><span class="pre">URLError</span></tt></a>), an
  82. <a title="urllib.error.HTTPError" class="reference internal" href="#urllib.error.HTTPError"><tt class="xref docutils literal"><span class="pre">HTTPError</span></tt></a> can also function as a non-exceptional file-like return
  83. value (the same thing that <tt class="xref docutils literal"><span class="pre">urlopen()</span></tt> returns). This is useful when
  84. handling exotic HTTP errors, such as requests for authentication.</p>
  85. <dl class="attribute">
  86. <dt id="urllib.error.HTTPError.code">
  87. <tt class="descname">code</tt><a class="headerlink" href="#urllib.error.HTTPError.code" title="Link permanente para esta defini&ccedil;&atilde;o"></a></dt>
  88. <dd>An HTTP status code as defined in <a class="reference external" href="http://www.faqs.org/rfcs/rfc2616.html">RFC 2616</a>. This numeric value corresponds
  89. to a value found in the dictionary of codes as found in
  90. <a title="http.server.BaseHTTPRequestHandler.responses" class="reference external" href="http.server.html#http.server.BaseHTTPRequestHandler.responses"><tt class="xref docutils literal"><span class="pre">http.server.BaseHTTPRequestHandler.responses</span></tt></a>.</dd></dl>
  91. </dd></dl>
  92. <dl class="exception">
  93. <dt id="urllib.error.ContentTooShortError">
  94. <em class="property">
  95. exception </em><tt class="descclassname">urllib.error.</tt><tt class="descname">ContentTooShortError</tt><big>(</big><em>msg</em><span class="optional">[</span>, <em>content</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#urllib.error.ContentTooShortError" title="Link permanente para esta defini&ccedil;&atilde;o"></a></dt>
  96. <dd>This exception is raised when the <tt class="xref docutils literal"><span class="pre">urlretrieve()</span></tt> function detects that
  97. the amount of the downloaded data is less than the expected amount (given by
  98. the <em>Content-Length</em> header). The <tt class="xref docutils literal"><span class="pre">content</span></tt> attribute stores the
  99. downloaded (and supposedly truncated) data.</dd></dl>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. <div class="sphinxsidebar">
  105. <div class="sphinxsidebarwrapper">
  106. <h4>T&oacute;pico anterior</h4>
  107. <p class="topless"><a href="urllib.parse.html"
  108. title="cap&iacute;tulo anterior">20.7. <tt class="docutils literal"><span class="pre">urllib.parse</span></tt> &#8212; Parse URLs into components</a></p>
  109. <h4>Pr&oacute;ximo t&oacute;pico</h4>
  110. <p class="topless"><a href="urllib.robotparser.html"
  111. title="pr&oacute;ximo cap&iacute;tulo">20.9. <tt class="docutils literal docutils literal"><span class="pre">urllib.robotparser</span></tt> &#8212; Parser for robots.txt</a></p>
  112. <h3>Esta p&aacute;gina</h3>
  113. <ul class="this-page-menu">
  114. <li><a href="../_sources/library/urllib.error.txt"
  115. rel="nofollow">Mostrar fonte</a></li>
  116. </ul>
  117. <div id="searchbox" style="display: none">
  118. <h3>Busca r&aacute;pida</h3>
  119. <form class="search" action="../search.html" method="get">
  120. <input type="text" name="q" size="18" />
  121. <input type="submit" value="Ir" />
  122. <input type="hidden" name="check_keywords" value="yes" />
  123. <input type="hidden" name="area" value="default" />
  124. </form>
  125. <p class="searchtip" style="font-size: 90%">
  126. Informe o termo, m&oacute;dulo, classe ou nome de fun&ccedil;&atilde;o para buscar.
  127. </p>
  128. </div>
  129. <script type="text/javascript">$('#searchbox').show(0);</script>
  130. </div>
  131. </div>
  132. <div class="clearer"></div>
  133. </div>
  134. <div class="related">
  135. <h3>Navigation</h3>
  136. <ul>
  137. <li class="right" style="margin-right: 10px">
  138. <a href="../genindex.html" title="Índice Geral"
  139. >&iacute;ndice</a></li>
  140. <li class="right" >
  141. <a href="../modindex.html" title="Índice Global de Móodulos"
  142. >m&oacute;dulos</a> |</li>
  143. <li class="right" >
  144. <a href="urllib.robotparser.html" title="20.9. urllib.robotparser — Parser for robots.txt"
  145. >pr&oacute;ximo</a> |</li>
  146. <li class="right" >
  147. <a href="urllib.parse.html" title="20.7. urllib.parse — Parse URLs into components"
  148. >anterior</a> |</li>
  149. <li><img src="../_static/py.png" alt=""
  150. style="vertical-align: middle; margin-top: -1px"/></li>
  151. <li><a href="../index.html">Documentação Python v3.1c1</a> &raquo;</li>
  152. <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
  153. <li><a href="internet.html" >20. Internet Protocols and Support</a> &raquo;</li>
  154. </ul>
  155. </div>
  156. <div class="footer">
  157. &copy; <a href="../copyright.html">Copyright</a> 1990-2009, Python Software Foundation.
  158. Atualizado em Jun 28, 2009.
  159. Criado usando <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
  160. </div>
  161. </body>
  162. </html>