parthtamu/rag-code-assistant
0
1<!DOCTYPE html>2 3<html lang="en" data-content_root="../">4 <head>5 <meta charset="utf-8" />6 <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />7<meta property="og:title" content="http — HTTP modules" />8<meta property="og:type" content="website" />9<meta property="og:url" content="https://docs.python.org/3/library/http.html" />10<meta property="og:site_name" content="Python documentation" />11<meta property="og:description" content="Source code: Lib/http/__init__.py http is a package that collects several modules for working with the HyperText Transfer Protocol: http.client is a low-level HTTP protocol client; for high-level U..." />12<meta property="og:image:width" content="1146" />13<meta property="og:image:height" content="600" />14<meta property="og:image" content="https://docs.python.org/3.15/_images/social_previews/summary_library_http_9a51676a.png" />15<meta property="og:image:alt" content="Source code: Lib/http/__init__.py http is a package that collects several modules for working with the HyperText Transfer Protocol: http.client is a low-level HTTP protocol client; for high-level U..." />16<meta name="description" content="Source code: Lib/http/__init__.py http is a package that collects several modules for working with the HyperText Transfer Protocol: http.client is a low-level HTTP protocol client; for high-level U..." />17<meta name="twitter:card" content="summary_large_image" />18<meta name="theme-color" content="#3776ab">19 20 <title>http — HTTP modules — Python 3.15.0a6 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">21 22 <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />23 <link rel="stylesheet" type="text/css" href="../_static/classic.css?v=234b1a7c" />24 <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=89a2f22a" />25 <link rel="stylesheet" type="text/css" href="../_static/profiling-sampling-visualization.css?v=0c2600ae" />26 <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />27 28 <script src="../_static/documentation_options.js?v=6b7c9ff5"></script>29 <script src="../_static/doctools.js?v=9bcbadda"></script>30 <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>31 <script src="../_static/profiling-sampling-visualization.js?v=9811ed04"></script>32 33 <script src="../_static/sidebar.js"></script>34 35 <link rel="search" type="application/opensearchdescription+xml"36 title="Search within Python 3.15.0a6 documentation"37 href="../_static/opensearch.xml"/>38 <link rel="author" title="About these documents" href="../about.html" />39 <link rel="index" title="Index" href="../genindex.html" />40 <link rel="search" title="Search" href="../search.html" />41 <link rel="copyright" title="Copyright" href="../copyright.html" />42 <link rel="next" title="http.client — HTTP protocol client" href="http.client.html" />43 <link rel="prev" title="urllib.robotparser — Parser for robots.txt" href="urllib.robotparser.html" />44 45 46 <script defer file-types="bz2,epub,zip" data-domain="docs.python.org" src="https://analytics.python.org/js/script.file-downloads.outbound-links.js"></script>47 48 <link rel="canonical" href="https://docs.python.org/3/library/http.html">49 50 51 52 53 <style>54 @media only screen {55 table.full-width-table {56 width: 100%;57 }58 }59 </style>60<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">61 <link rel="shortcut icon" type="image/png" href="../_static/py.svg">62 <script type="text/javascript" src="../_static/copybutton.js"></script>63 <script type="text/javascript" src="../_static/menu.js"></script>64 <script type="text/javascript" src="../_static/search-focus.js"></script>65 <script type="text/javascript" src="../_static/themetoggle.js"></script> 66 <script type="text/javascript" src="../_static/rtd_switcher.js"></script>67 <meta name="readthedocs-addons-api-version" content="1">68 69 </head>70<body>71<div class="mobile-nav">72 <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"73 aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu">74 <nav class="nav-content" role="navigation">75 <label for="menuToggler" class="toggler__label">76 <span></span>77 </label>78 <span class="nav-items-wrapper">79 <a href="https://www.python.org/" class="nav-logo">80 <img src="../_static/py.svg" alt="Python logo">81 </a>82 <span class="version_switcher_placeholder"></span>83 <form role="search" class="search" action="../search.html" method="get">84 <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">85 <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>86 </svg>87 <input placeholder="Quick search" aria-label="Quick search" type="search" name="q">88 <input type="submit" value="Go">89 </form>90 </span>91 </nav>92 <div class="menu-wrapper">93 <nav class="menu" role="navigation" aria-label="main navigation">94 <div class="language_switcher_placeholder"></div>95 96<label class="theme-selector-label">97 Theme98 <select class="theme-selector" oninput="activateTheme(this.value)">99 <option value="auto" selected>Auto</option>100 <option value="light">Light</option>101 <option value="dark">Dark</option>102 </select>103</label>104 <div>105 <h3><a href="../contents.html">Table of Contents</a></h3>106 <ul>107<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">http</span></code> — HTTP modules</a><ul>108<li><a class="reference internal" href="#http-status-codes">HTTP status codes</a></li>109<li><a class="reference internal" href="#http-status-category">HTTP status category</a></li>110<li><a class="reference internal" href="#http-methods">HTTP methods</a></li>111</ul>112</li>113</ul>114 115 </div>116 <div>117 <h4>Previous topic</h4>118 <p class="topless"><a href="urllib.robotparser.html"119 title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">urllib.robotparser</span></code> — Parser for robots.txt</a></p>120 </div>121 <div>122 <h4>Next topic</h4>123 <p class="topless"><a href="http.client.html"124 title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">http.client</span></code> — HTTP protocol client</a></p>125 </div>126 <script>127 document.addEventListener('DOMContentLoaded', () => {128 const title = document.querySelector('meta[property="og:title"]').content;129 const elements = document.querySelectorAll('.improvepage');130 const pageurl = window.location.href.split('?')[0];131 elements.forEach(element => {132 const url = new URL(element.href.split('?')[0].replace("-nojs", ""));133 url.searchParams.set('pagetitle', title);134 url.searchParams.set('pageurl', pageurl);135 url.searchParams.set('pagesource', "library/http.rst");136 element.href = url.toString();137 });138 });139 </script>140 <div role="note" aria-label="source link">141 <h3>This page</h3>142 <ul class="this-page-menu">143 <li><a href="../bugs.html">Report a bug</a></li>144 <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>145 <li>146 <a href="https://github.com/python/cpython/blob/main/Doc/library/http.rst?plain=1"147 rel="nofollow">Show source148 </a>149 </li>150 151 </ul>152 </div>153 </nav>154 </div>155</div>156 157 158 <div class="related" role="navigation" aria-label="Related">159 <h3>Navigation</h3>160 <ul>161 <li class="right" style="margin-right: 10px">162 <a href="../genindex.html" title="General Index"163 accesskey="I">index</a></li>164 <li class="right" >165 <a href="../py-modindex.html" title="Python Module Index"166 >modules</a> |</li>167 <li class="right" >168 <a href="http.client.html" title="http.client — HTTP protocol client"169 accesskey="N">next</a> |</li>170 <li class="right" >171 <a href="urllib.robotparser.html" title="urllib.robotparser — Parser for robots.txt"172 accesskey="P">previous</a> |</li>173 174 <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>175 <li><a href="https://www.python.org/">Python</a> »</li>176 <li class="switchers">177 <div class="language_switcher_placeholder"></div>178 <div class="version_switcher_placeholder"></div>179 </li>180 <li>181 182 </li>183 <li id="cpython-language-and-version">184 <a href="../index.html">3.15.0a6 Documentation</a> »185 </li>186 187 <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>188 <li class="nav-item nav-item-2"><a href="internet.html" accesskey="U">Internet Protocols and Support</a> »</li>189 <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">http</span></code> — HTTP modules</a></li>190 <li class="right">191 192 193 <div class="inline-search" role="search">194 <form class="inline-search" action="../search.html" method="get">195 <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">196 <input type="submit" value="Go">197 </form>198 </div>199 |200 </li>201 <li class="right">202<label class="theme-selector-label">203 Theme204 <select class="theme-selector" oninput="activateTheme(this.value)">205 <option value="auto" selected>Auto</option>206 <option value="light">Light</option>207 <option value="dark">Dark</option>208 </select>209</label> |</li>210 211 </ul>212 </div> 213 214 <div class="document">215 <div class="documentwrapper">216 <div class="bodywrapper">217 <div class="body" role="main">218 219 <section id="module-http">220<span id="http-http-modules"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">http</span></code> — HTTP modules<a class="headerlink" href="#module-http" title="Link to this heading">¶</a></h1>221<p><strong>Source code:</strong> <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/main/Lib/http/__init__.py">Lib/http/__init__.py</a></p>222<hr class="docutils" id="index-0" />223<p><code class="xref py py-mod docutils literal notranslate"><span class="pre">http</span></code> is a package that collects several modules for working with the224HyperText Transfer Protocol:</p>225<ul class="simple">226<li><p><a class="reference internal" href="http.client.html#module-http.client" title="http.client: HTTP and HTTPS protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">http.client</span></code></a> is a low-level HTTP protocol client; for high-level URL227opening use <a class="reference internal" href="urllib.request.html#module-urllib.request" title="urllib.request: Extensible library for opening URLs."><code class="xref py py-mod docutils literal notranslate"><span class="pre">urllib.request</span></code></a></p></li>228<li><p><a class="reference internal" href="http.server.html#module-http.server" title="http.server: HTTP server and request handlers."><code class="xref py py-mod docutils literal notranslate"><span class="pre">http.server</span></code></a> contains basic HTTP server classes based on <a class="reference internal" href="socketserver.html#module-socketserver" title="socketserver: A framework for network servers."><code class="xref py py-mod docutils literal notranslate"><span class="pre">socketserver</span></code></a></p></li>229<li><p><a class="reference internal" href="http.cookies.html#module-http.cookies" title="http.cookies: Support for HTTP state management (cookies)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">http.cookies</span></code></a> has utilities for implementing state management with cookies</p></li>230<li><p><a class="reference internal" href="http.cookiejar.html#module-http.cookiejar" title="http.cookiejar: Classes for automatic handling of HTTP cookies."><code class="xref py py-mod docutils literal notranslate"><span class="pre">http.cookiejar</span></code></a> provides persistence of cookies</p></li>231</ul>232<p>The <code class="xref py py-mod docutils literal notranslate"><span class="pre">http</span></code> module also defines the following enums that help you work with http related code:</p>233<dl class="py class">234<dt class="sig sig-object py" id="http.HTTPStatus">235<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">http.</span></span><span class="sig-name descname"><span class="pre">HTTPStatus</span></span><a class="headerlink" href="#http.HTTPStatus" title="Link to this definition">¶</a></dt>236<dd><div class="versionadded">237<p><span class="versionmodified added">Added in version 3.5.</span></p>238</div>239<p>A subclass of <a class="reference internal" href="enum.html#enum.IntEnum" title="enum.IntEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">enum.IntEnum</span></code></a> that defines a set of HTTP status codes,240reason phrases and long descriptions written in English.</p>241<p>Usage:</p>242<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span><span class="w"> </span><span class="nn">http</span><span class="w"> </span><span class="kn">import</span> <span class="n">HTTPStatus</span>243<span class="gp">>>> </span><span class="n">HTTPStatus</span><span class="o">.</span><span class="n">OK</span>244<span class="go">HTTPStatus.OK</span>245<span class="gp">>>> </span><span class="n">HTTPStatus</span><span class="o">.</span><span class="n">OK</span> <span class="o">==</span> <span class="mi">200</span>246<span class="go">True</span>247<span class="gp">>>> </span><span class="n">HTTPStatus</span><span class="o">.</span><span class="n">OK</span><span class="o">.</span><span class="n">value</span>248<span class="go">200</span>249<span class="gp">>>> </span><span class="n">HTTPStatus</span><span class="o">.</span><span class="n">OK</span><span class="o">.</span><span class="n">phrase</span>250<span class="go">'OK'</span>251<span class="gp">>>> </span><span class="n">HTTPStatus</span><span class="o">.</span><span class="n">OK</span><span class="o">.</span><span class="n">description</span>252<span class="go">'Request fulfilled, document follows'</span>253<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">HTTPStatus</span><span class="p">)</span>254<span class="go">[HTTPStatus.CONTINUE, HTTPStatus.SWITCHING_PROTOCOLS, ...]</span>255</pre></div>256</div>257</dd></dl>258 259<section id="http-status-codes">260<span id="id1"></span><h2>HTTP status codes<a class="headerlink" href="#http-status-codes" title="Link to this heading">¶</a></h2>261<p>Supported,262<a class="reference external" href="https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml">IANA-registered status codes</a>263available in <a class="reference internal" href="#http.HTTPStatus" title="http.HTTPStatus"><code class="xref py py-class docutils literal notranslate"><span class="pre">http.HTTPStatus</span></code></a> are:</p>264<table class="docutils align-default">265<thead>266<tr class="row-odd"><th class="head"><p>Code</p></th>267<th class="head"><p>Enum Name</p></th>268<th class="head"><p>Details</p></th>269</tr>270</thead>271<tbody>272<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">100</span></code></p></td>273<td><p><code class="docutils literal notranslate"><span class="pre">CONTINUE</span></code></p></td>274<td><p>HTTP Semantics <span class="target" id="index-1"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.2.1</p></td>275</tr>276<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">101</span></code></p></td>277<td><p><code class="docutils literal notranslate"><span class="pre">SWITCHING_PROTOCOLS</span></code></p></td>278<td><p>HTTP Semantics <span class="target" id="index-2"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.2.2</p></td>279</tr>280<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">102</span></code></p></td>281<td><p><code class="docutils literal notranslate"><span class="pre">PROCESSING</span></code></p></td>282<td><p>WebDAV <span class="target" id="index-3"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2518.html"><strong>RFC 2518</strong></a>, Section 10.1</p></td>283</tr>284<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">103</span></code></p></td>285<td><p><code class="docutils literal notranslate"><span class="pre">EARLY_HINTS</span></code></p></td>286<td><p>An HTTP Status Code for Indicating Hints <span class="target" id="index-4"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc8297.html"><strong>RFC 8297</strong></a></p></td>287</tr>288<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">200</span></code></p></td>289<td><p><code class="docutils literal notranslate"><span class="pre">OK</span></code></p></td>290<td><p>HTTP Semantics <span class="target" id="index-5"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.3.1</p></td>291</tr>292<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">201</span></code></p></td>293<td><p><code class="docutils literal notranslate"><span class="pre">CREATED</span></code></p></td>294<td><p>HTTP Semantics <span class="target" id="index-6"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.3.2</p></td>295</tr>296<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">202</span></code></p></td>297<td><p><code class="docutils literal notranslate"><span class="pre">ACCEPTED</span></code></p></td>298<td><p>HTTP Semantics <span class="target" id="index-7"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.3.3</p></td>299</tr>300<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">203</span></code></p></td>301<td><p><code class="docutils literal notranslate"><span class="pre">NON_AUTHORITATIVE_INFORMATION</span></code></p></td>302<td><p>HTTP Semantics <span class="target" id="index-8"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.3.4</p></td>303</tr>304<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">204</span></code></p></td>305<td><p><code class="docutils literal notranslate"><span class="pre">NO_CONTENT</span></code></p></td>306<td><p>HTTP Semantics <span class="target" id="index-9"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.3.5</p></td>307</tr>308<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">205</span></code></p></td>309<td><p><code class="docutils literal notranslate"><span class="pre">RESET_CONTENT</span></code></p></td>310<td><p>HTTP Semantics <span class="target" id="index-10"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.3.6</p></td>311</tr>312<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">206</span></code></p></td>313<td><p><code class="docutils literal notranslate"><span class="pre">PARTIAL_CONTENT</span></code></p></td>314<td><p>HTTP Semantics <span class="target" id="index-11"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.3.7</p></td>315</tr>316<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">207</span></code></p></td>317<td><p><code class="docutils literal notranslate"><span class="pre">MULTI_STATUS</span></code></p></td>318<td><p>WebDAV <span class="target" id="index-12"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc4918.html"><strong>RFC 4918</strong></a>, Section 11.1</p></td>319</tr>320<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">208</span></code></p></td>321<td><p><code class="docutils literal notranslate"><span class="pre">ALREADY_REPORTED</span></code></p></td>322<td><p>WebDAV Binding Extensions <span class="target" id="index-13"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc5842.html"><strong>RFC 5842</strong></a>, Section 7.1 (Experimental)</p></td>323</tr>324<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">226</span></code></p></td>325<td><p><code class="docutils literal notranslate"><span class="pre">IM_USED</span></code></p></td>326<td><p>Delta Encoding in HTTP <span class="target" id="index-14"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc3229.html"><strong>RFC 3229</strong></a>, Section 10.4.1</p></td>327</tr>328<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">300</span></code></p></td>329<td><p><code class="docutils literal notranslate"><span class="pre">MULTIPLE_CHOICES</span></code></p></td>330<td><p>HTTP Semantics <span class="target" id="index-15"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.4.1</p></td>331</tr>332<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">301</span></code></p></td>333<td><p><code class="docutils literal notranslate"><span class="pre">MOVED_PERMANENTLY</span></code></p></td>334<td><p>HTTP Semantics <span class="target" id="index-16"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.4.2</p></td>335</tr>336<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">302</span></code></p></td>337<td><p><code class="docutils literal notranslate"><span class="pre">FOUND</span></code></p></td>338<td><p>HTTP Semantics <span class="target" id="index-17"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.4.3</p></td>339</tr>340<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">303</span></code></p></td>341<td><p><code class="docutils literal notranslate"><span class="pre">SEE_OTHER</span></code></p></td>342<td><p>HTTP Semantics <span class="target" id="index-18"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.4.4</p></td>343</tr>344<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">304</span></code></p></td>345<td><p><code class="docutils literal notranslate"><span class="pre">NOT_MODIFIED</span></code></p></td>346<td><p>HTTP Semantics <span class="target" id="index-19"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.4.5</p></td>347</tr>348<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">305</span></code></p></td>349<td><p><code class="docutils literal notranslate"><span class="pre">USE_PROXY</span></code></p></td>350<td><p>HTTP Semantics <span class="target" id="index-20"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.4.6</p></td>351</tr>352<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">307</span></code></p></td>353<td><p><code class="docutils literal notranslate"><span class="pre">TEMPORARY_REDIRECT</span></code></p></td>354<td><p>HTTP Semantics <span class="target" id="index-21"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.4.8</p></td>355</tr>356<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">308</span></code></p></td>357<td><p><code class="docutils literal notranslate"><span class="pre">PERMANENT_REDIRECT</span></code></p></td>358<td><p>HTTP Semantics <span class="target" id="index-22"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.4.9</p></td>359</tr>360<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">400</span></code></p></td>361<td><p><code class="docutils literal notranslate"><span class="pre">BAD_REQUEST</span></code></p></td>362<td><p>HTTP Semantics <span class="target" id="index-23"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.1</p></td>363</tr>364<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">401</span></code></p></td>365<td><p><code class="docutils literal notranslate"><span class="pre">UNAUTHORIZED</span></code></p></td>366<td><p>HTTP Semantics <span class="target" id="index-24"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.2</p></td>367</tr>368<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">402</span></code></p></td>369<td><p><code class="docutils literal notranslate"><span class="pre">PAYMENT_REQUIRED</span></code></p></td>370<td><p>HTTP Semantics <span class="target" id="index-25"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.3</p></td>371</tr>372<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">403</span></code></p></td>373<td><p><code class="docutils literal notranslate"><span class="pre">FORBIDDEN</span></code></p></td>374<td><p>HTTP Semantics <span class="target" id="index-26"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.4</p></td>375</tr>376<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">404</span></code></p></td>377<td><p><code class="docutils literal notranslate"><span class="pre">NOT_FOUND</span></code></p></td>378<td><p>HTTP Semantics <span class="target" id="index-27"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.5</p></td>379</tr>380<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">405</span></code></p></td>381<td><p><code class="docutils literal notranslate"><span class="pre">METHOD_NOT_ALLOWED</span></code></p></td>382<td><p>HTTP Semantics <span class="target" id="index-28"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.6</p></td>383</tr>384<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">406</span></code></p></td>385<td><p><code class="docutils literal notranslate"><span class="pre">NOT_ACCEPTABLE</span></code></p></td>386<td><p>HTTP Semantics <span class="target" id="index-29"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.7</p></td>387</tr>388<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">407</span></code></p></td>389<td><p><code class="docutils literal notranslate"><span class="pre">PROXY_AUTHENTICATION_REQUIRED</span></code></p></td>390<td><p>HTTP Semantics <span class="target" id="index-30"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.8</p></td>391</tr>392<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">408</span></code></p></td>393<td><p><code class="docutils literal notranslate"><span class="pre">REQUEST_TIMEOUT</span></code></p></td>394<td><p>HTTP Semantics <span class="target" id="index-31"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.9</p></td>395</tr>396<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">409</span></code></p></td>397<td><p><code class="docutils literal notranslate"><span class="pre">CONFLICT</span></code></p></td>398<td><p>HTTP Semantics <span class="target" id="index-32"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.10</p></td>399</tr>400<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">410</span></code></p></td>401<td><p><code class="docutils literal notranslate"><span class="pre">GONE</span></code></p></td>402<td><p>HTTP Semantics <span class="target" id="index-33"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.11</p></td>403</tr>404<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">411</span></code></p></td>405<td><p><code class="docutils literal notranslate"><span class="pre">LENGTH_REQUIRED</span></code></p></td>406<td><p>HTTP Semantics <span class="target" id="index-34"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.12</p></td>407</tr>408<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">412</span></code></p></td>409<td><p><code class="docutils literal notranslate"><span class="pre">PRECONDITION_FAILED</span></code></p></td>410<td><p>HTTP Semantics <span class="target" id="index-35"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.13</p></td>411</tr>412<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">413</span></code></p></td>413<td><p><code class="docutils literal notranslate"><span class="pre">CONTENT_TOO_LARGE</span></code></p></td>414<td><p>HTTP Semantics <span class="target" id="index-36"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.14</p></td>415</tr>416<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">414</span></code></p></td>417<td><p><code class="docutils literal notranslate"><span class="pre">URI_TOO_LONG</span></code></p></td>418<td><p>HTTP Semantics <span class="target" id="index-37"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.15</p></td>419</tr>420<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">415</span></code></p></td>421<td><p><code class="docutils literal notranslate"><span class="pre">UNSUPPORTED_MEDIA_TYPE</span></code></p></td>422<td><p>HTTP Semantics <span class="target" id="index-38"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.16</p></td>423</tr>424<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">416</span></code></p></td>425<td><p><code class="docutils literal notranslate"><span class="pre">RANGE_NOT_SATISFIABLE</span></code></p></td>426<td><p>HTTP Semantics <span class="target" id="index-39"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.17</p></td>427</tr>428<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">417</span></code></p></td>429<td><p><code class="docutils literal notranslate"><span class="pre">EXPECTATION_FAILED</span></code></p></td>430<td><p>HTTP Semantics <span class="target" id="index-40"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.18</p></td>431</tr>432<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">418</span></code></p></td>433<td><p><code class="docutils literal notranslate"><span class="pre">IM_A_TEAPOT</span></code></p></td>434<td><p>HTCPCP/1.0 <span class="target" id="index-41"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2324.html"><strong>RFC 2324</strong></a>, Section 2.3.2</p></td>435</tr>436<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">421</span></code></p></td>437<td><p><code class="docutils literal notranslate"><span class="pre">MISDIRECTED_REQUEST</span></code></p></td>438<td><p>HTTP Semantics <span class="target" id="index-42"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.20</p></td>439</tr>440<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">422</span></code></p></td>441<td><p><code class="docutils literal notranslate"><span class="pre">UNPROCESSABLE_CONTENT</span></code></p></td>442<td><p>HTTP Semantics <span class="target" id="index-43"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.21</p></td>443</tr>444<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">423</span></code></p></td>445<td><p><code class="docutils literal notranslate"><span class="pre">LOCKED</span></code></p></td>446<td><p>WebDAV <span class="target" id="index-44"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc4918.html"><strong>RFC 4918</strong></a>, Section 11.3</p></td>447</tr>448<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">424</span></code></p></td>449<td><p><code class="docutils literal notranslate"><span class="pre">FAILED_DEPENDENCY</span></code></p></td>450<td><p>WebDAV <span class="target" id="index-45"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc4918.html"><strong>RFC 4918</strong></a>, Section 11.4</p></td>451</tr>452<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">425</span></code></p></td>453<td><p><code class="docutils literal notranslate"><span class="pre">TOO_EARLY</span></code></p></td>454<td><p>Using Early Data in HTTP <span class="target" id="index-46"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc8470.html"><strong>RFC 8470</strong></a></p></td>455</tr>456<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">426</span></code></p></td>457<td><p><code class="docutils literal notranslate"><span class="pre">UPGRADE_REQUIRED</span></code></p></td>458<td><p>HTTP Semantics <span class="target" id="index-47"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.5.22</p></td>459</tr>460<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">428</span></code></p></td>461<td><p><code class="docutils literal notranslate"><span class="pre">PRECONDITION_REQUIRED</span></code></p></td>462<td><p>Additional HTTP Status Codes <span class="target" id="index-48"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc6585.html"><strong>RFC 6585</strong></a></p></td>463</tr>464<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">429</span></code></p></td>465<td><p><code class="docutils literal notranslate"><span class="pre">TOO_MANY_REQUESTS</span></code></p></td>466<td><p>Additional HTTP Status Codes <span class="target" id="index-49"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc6585.html"><strong>RFC 6585</strong></a></p></td>467</tr>468<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">431</span></code></p></td>469<td><p><code class="docutils literal notranslate"><span class="pre">REQUEST_HEADER_FIELDS_TOO_LARGE</span></code></p></td>470<td><p>Additional HTTP Status Codes <span class="target" id="index-50"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc6585.html"><strong>RFC 6585</strong></a></p></td>471</tr>472<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">451</span></code></p></td>473<td><p><code class="docutils literal notranslate"><span class="pre">UNAVAILABLE_FOR_LEGAL_REASONS</span></code></p></td>474<td><p>An HTTP Status Code to Report Legal Obstacles <span class="target" id="index-51"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc7725.html"><strong>RFC 7725</strong></a></p></td>475</tr>476<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">500</span></code></p></td>477<td><p><code class="docutils literal notranslate"><span class="pre">INTERNAL_SERVER_ERROR</span></code></p></td>478<td><p>HTTP Semantics <span class="target" id="index-52"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.6.1</p></td>479</tr>480<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">501</span></code></p></td>481<td><p><code class="docutils literal notranslate"><span class="pre">NOT_IMPLEMENTED</span></code></p></td>482<td><p>HTTP Semantics <span class="target" id="index-53"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.6.2</p></td>483</tr>484<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">502</span></code></p></td>485<td><p><code class="docutils literal notranslate"><span class="pre">BAD_GATEWAY</span></code></p></td>486<td><p>HTTP Semantics <span class="target" id="index-54"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.6.3</p></td>487</tr>488<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">503</span></code></p></td>489<td><p><code class="docutils literal notranslate"><span class="pre">SERVICE_UNAVAILABLE</span></code></p></td>490<td><p>HTTP Semantics <span class="target" id="index-55"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.6.4</p></td>491</tr>492<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">504</span></code></p></td>493<td><p><code class="docutils literal notranslate"><span class="pre">GATEWAY_TIMEOUT</span></code></p></td>494<td><p>HTTP Semantics <span class="target" id="index-56"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.6.5</p></td>495</tr>496<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">505</span></code></p></td>497<td><p><code class="docutils literal notranslate"><span class="pre">HTTP_VERSION_NOT_SUPPORTED</span></code></p></td>498<td><p>HTTP Semantics <span class="target" id="index-57"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15.6.6</p></td>499</tr>500<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">506</span></code></p></td>501<td><p><code class="docutils literal notranslate"><span class="pre">VARIANT_ALSO_NEGOTIATES</span></code></p></td>502<td><p>Transparent Content Negotiation in HTTP <span class="target" id="index-58"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2295.html"><strong>RFC 2295</strong></a>, Section 8.1 (Experimental)</p></td>503</tr>504<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">507</span></code></p></td>505<td><p><code class="docutils literal notranslate"><span class="pre">INSUFFICIENT_STORAGE</span></code></p></td>506<td><p>WebDAV <span class="target" id="index-59"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc4918.html"><strong>RFC 4918</strong></a>, Section 11.5</p></td>507</tr>508<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">508</span></code></p></td>509<td><p><code class="docutils literal notranslate"><span class="pre">LOOP_DETECTED</span></code></p></td>510<td><p>WebDAV Binding Extensions <span class="target" id="index-60"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc5842.html"><strong>RFC 5842</strong></a>, Section 7.2 (Experimental)</p></td>511</tr>512<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">510</span></code></p></td>513<td><p><code class="docutils literal notranslate"><span class="pre">NOT_EXTENDED</span></code></p></td>514<td><p>An HTTP Extension Framework <span class="target" id="index-61"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2774.html"><strong>RFC 2774</strong></a>, Section 7 (Experimental)</p></td>515</tr>516<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">511</span></code></p></td>517<td><p><code class="docutils literal notranslate"><span class="pre">NETWORK_AUTHENTICATION_REQUIRED</span></code></p></td>518<td><p>Additional HTTP Status Codes <span class="target" id="index-62"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc6585.html"><strong>RFC 6585</strong></a>, Section 6</p></td>519</tr>520</tbody>521</table>522<p>In order to preserve backwards compatibility, enum values are also present523in the <a class="reference internal" href="http.client.html#module-http.client" title="http.client: HTTP and HTTPS protocol client (requires sockets)."><code class="xref py py-mod docutils literal notranslate"><span class="pre">http.client</span></code></a> module in the form of constants. The enum name is524equal to the constant name (i.e. <code class="docutils literal notranslate"><span class="pre">http.HTTPStatus.OK</span></code> is also available as525<code class="docutils literal notranslate"><span class="pre">http.client.OK</span></code>).</p>526<div class="versionchanged">527<p><span class="versionmodified changed">Changed in version 3.7: </span>Added <code class="docutils literal notranslate"><span class="pre">421</span> <span class="pre">MISDIRECTED_REQUEST</span></code> status code.</p>528</div>529<div class="versionadded">530<p><span class="versionmodified added">Added in version 3.8: </span>Added <code class="docutils literal notranslate"><span class="pre">451</span> <span class="pre">UNAVAILABLE_FOR_LEGAL_REASONS</span></code> status code.</p>531</div>532<div class="versionadded">533<p><span class="versionmodified added">Added in version 3.9: </span>Added <code class="docutils literal notranslate"><span class="pre">103</span> <span class="pre">EARLY_HINTS</span></code>, <code class="docutils literal notranslate"><span class="pre">418</span> <span class="pre">IM_A_TEAPOT</span></code> and <code class="docutils literal notranslate"><span class="pre">425</span> <span class="pre">TOO_EARLY</span></code> status codes.</p>534</div>535<div class="versionchanged">536<p><span class="versionmodified changed">Changed in version 3.13: </span>Implemented RFC9110 naming for status constants. Old constant names are preserved for537backwards compatibility: <code class="docutils literal notranslate"><span class="pre">413</span> <span class="pre">REQUEST_ENTITY_TOO_LARGE</span></code>, <code class="docutils literal notranslate"><span class="pre">414</span> <span class="pre">REQUEST_URI_TOO_LONG</span></code>,538<code class="docutils literal notranslate"><span class="pre">416</span> <span class="pre">REQUESTED_RANGE_NOT_SATISFIABLE</span></code> and <code class="docutils literal notranslate"><span class="pre">422</span> <span class="pre">UNPROCESSABLE_ENTITY</span></code>.</p>539</div>540</section>541<section id="http-status-category">542<h2>HTTP status category<a class="headerlink" href="#http-status-category" title="Link to this heading">¶</a></h2>543<div class="versionadded">544<p><span class="versionmodified added">Added in version 3.12.</span></p>545</div>546<p>The enum values have several properties to indicate the HTTP status category:</p>547<table class="docutils align-default">548<thead>549<tr class="row-odd"><th class="head"><p>Property</p></th>550<th class="head"><p>Indicates that</p></th>551<th class="head"><p>Details</p></th>552</tr>553</thead>554<tbody>555<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">is_informational</span></code></p></td>556<td><p><code class="docutils literal notranslate"><span class="pre">100</span> <span class="pre"><=</span> <span class="pre">status</span> <span class="pre"><=</span> <span class="pre">199</span></code></p></td>557<td><p>HTTP Semantics <span class="target" id="index-63"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15</p></td>558</tr>559<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">is_success</span></code></p></td>560<td><p><code class="docutils literal notranslate"><span class="pre">200</span> <span class="pre"><=</span> <span class="pre">status</span> <span class="pre"><=</span> <span class="pre">299</span></code></p></td>561<td><p>HTTP Semantics <span class="target" id="index-64"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15</p></td>562</tr>563<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">is_redirection</span></code></p></td>564<td><p><code class="docutils literal notranslate"><span class="pre">300</span> <span class="pre"><=</span> <span class="pre">status</span> <span class="pre"><=</span> <span class="pre">399</span></code></p></td>565<td><p>HTTP Semantics <span class="target" id="index-65"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15</p></td>566</tr>567<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">is_client_error</span></code></p></td>568<td><p><code class="docutils literal notranslate"><span class="pre">400</span> <span class="pre"><=</span> <span class="pre">status</span> <span class="pre"><=</span> <span class="pre">499</span></code></p></td>569<td><p>HTTP Semantics <span class="target" id="index-66"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15</p></td>570</tr>571<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">is_server_error</span></code></p></td>572<td><p><code class="docutils literal notranslate"><span class="pre">500</span> <span class="pre"><=</span> <span class="pre">status</span> <span class="pre"><=</span> <span class="pre">599</span></code></p></td>573<td><p>HTTP Semantics <span class="target" id="index-67"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 15</p></td>574</tr>575</tbody>576</table>577<blockquote>578<div><p>Usage:</p>579<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span><span class="w"> </span><span class="nn">http</span><span class="w"> </span><span class="kn">import</span> <span class="n">HTTPStatus</span>580<span class="gp">>>> </span><span class="n">HTTPStatus</span><span class="o">.</span><span class="n">OK</span><span class="o">.</span><span class="n">is_success</span>581<span class="go">True</span>582<span class="gp">>>> </span><span class="n">HTTPStatus</span><span class="o">.</span><span class="n">OK</span><span class="o">.</span><span class="n">is_client_error</span>583<span class="go">False</span>584</pre></div>585</div>586</div></blockquote>587<dl class="py class">588<dt class="sig sig-object py" id="http.HTTPMethod">589<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">http.</span></span><span class="sig-name descname"><span class="pre">HTTPMethod</span></span><a class="headerlink" href="#http.HTTPMethod" title="Link to this definition">¶</a></dt>590<dd><div class="versionadded">591<p><span class="versionmodified added">Added in version 3.11.</span></p>592</div>593<p>A subclass of <a class="reference internal" href="enum.html#enum.StrEnum" title="enum.StrEnum"><code class="xref py py-class docutils literal notranslate"><span class="pre">enum.StrEnum</span></code></a> that defines a set of HTTP methods and descriptions written in English.</p>594<p>Usage:</p>595<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span><span class="w"> </span><span class="nn">http</span><span class="w"> </span><span class="kn">import</span> <span class="n">HTTPMethod</span>596<span class="gp">>>></span>597<span class="gp">>>> </span><span class="n">HTTPMethod</span><span class="o">.</span><span class="n">GET</span>598<span class="go"><HTTPMethod.GET></span>599<span class="gp">>>> </span><span class="n">HTTPMethod</span><span class="o">.</span><span class="n">GET</span> <span class="o">==</span> <span class="s1">'GET'</span>600<span class="go">True</span>601<span class="gp">>>> </span><span class="n">HTTPMethod</span><span class="o">.</span><span class="n">GET</span><span class="o">.</span><span class="n">value</span>602<span class="go">'GET'</span>603<span class="gp">>>> </span><span class="n">HTTPMethod</span><span class="o">.</span><span class="n">GET</span><span class="o">.</span><span class="n">description</span>604<span class="go">'Retrieve the target.'</span>605<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">HTTPMethod</span><span class="p">)</span>606<span class="go">[<HTTPMethod.CONNECT>,</span>607<span class="go"> <HTTPMethod.DELETE>,</span>608<span class="go"> <HTTPMethod.GET>,</span>609<span class="go"> <HTTPMethod.HEAD>,</span>610<span class="go"> <HTTPMethod.OPTIONS>,</span>611<span class="go"> <HTTPMethod.PATCH>,</span>612<span class="go"> <HTTPMethod.POST>,</span>613<span class="go"> <HTTPMethod.PUT>,</span>614<span class="go"> <HTTPMethod.TRACE>]</span>615</pre></div>616</div>617</dd></dl>618 619</section>620<section id="http-methods">621<span id="id2"></span><h2>HTTP methods<a class="headerlink" href="#http-methods" title="Link to this heading">¶</a></h2>622<p>Supported,623<a class="reference external" href="https://www.iana.org/assignments/http-methods/http-methods.xhtml">IANA-registered methods</a>624available in <a class="reference internal" href="#http.HTTPMethod" title="http.HTTPMethod"><code class="xref py py-class docutils literal notranslate"><span class="pre">http.HTTPMethod</span></code></a> are:</p>625<table class="docutils align-default">626<thead>627<tr class="row-odd"><th class="head"><p>Method</p></th>628<th class="head"><p>Enum Name</p></th>629<th class="head"><p>Details</p></th>630</tr>631</thead>632<tbody>633<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">GET</span></code></p></td>634<td><p><code class="docutils literal notranslate"><span class="pre">GET</span></code></p></td>635<td><p>HTTP Semantics <span class="target" id="index-68"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 9.3.1</p></td>636</tr>637<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">HEAD</span></code></p></td>638<td><p><code class="docutils literal notranslate"><span class="pre">HEAD</span></code></p></td>639<td><p>HTTP Semantics <span class="target" id="index-69"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 9.3.2</p></td>640</tr>641<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">POST</span></code></p></td>642<td><p><code class="docutils literal notranslate"><span class="pre">POST</span></code></p></td>643<td><p>HTTP Semantics <span class="target" id="index-70"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 9.3.3</p></td>644</tr>645<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">PUT</span></code></p></td>646<td><p><code class="docutils literal notranslate"><span class="pre">PUT</span></code></p></td>647<td><p>HTTP Semantics <span class="target" id="index-71"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 9.3.4</p></td>648</tr>649<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">DELETE</span></code></p></td>650<td><p><code class="docutils literal notranslate"><span class="pre">DELETE</span></code></p></td>651<td><p>HTTP Semantics <span class="target" id="index-72"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 9.3.5</p></td>652</tr>653<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">CONNECT</span></code></p></td>654<td><p><code class="docutils literal notranslate"><span class="pre">CONNECT</span></code></p></td>655<td><p>HTTP Semantics <span class="target" id="index-73"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 9.3.6</p></td>656</tr>657<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">OPTIONS</span></code></p></td>658<td><p><code class="docutils literal notranslate"><span class="pre">OPTIONS</span></code></p></td>659<td><p>HTTP Semantics <span class="target" id="index-74"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 9.3.7</p></td>660</tr>661<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">TRACE</span></code></p></td>662<td><p><code class="docutils literal notranslate"><span class="pre">TRACE</span></code></p></td>663<td><p>HTTP Semantics <span class="target" id="index-75"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc9110.html"><strong>RFC 9110</strong></a>, Section 9.3.8</p></td>664</tr>665<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">PATCH</span></code></p></td>666<td><p><code class="docutils literal notranslate"><span class="pre">PATCH</span></code></p></td>667<td><p>HTTP/1.1 <span class="target" id="index-76"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc5789.html"><strong>RFC 5789</strong></a></p></td>668</tr>669</tbody>670</table>671</section>672</section>673 674 675 <div class="clearer"></div>676 </div>677 </div>678 </div>679 <div class="sphinxsidebar" role="navigation" aria-label="Main">680 <div class="sphinxsidebarwrapper">681 <div>682 <h3><a href="../contents.html">Table of Contents</a></h3>683 <ul>684<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">http</span></code> — HTTP modules</a><ul>685<li><a class="reference internal" href="#http-status-codes">HTTP status codes</a></li>686<li><a class="reference internal" href="#http-status-category">HTTP status category</a></li>687<li><a class="reference internal" href="#http-methods">HTTP methods</a></li>688</ul>689</li>690</ul>691 692 </div>693 <div>694 <h4>Previous topic</h4>695 <p class="topless"><a href="urllib.robotparser.html"696 title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">urllib.robotparser</span></code> — Parser for robots.txt</a></p>697 </div>698 <div>699 <h4>Next topic</h4>700 <p class="topless"><a href="http.client.html"701 title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">http.client</span></code> — HTTP protocol client</a></p>702 </div>703 <script>704 document.addEventListener('DOMContentLoaded', () => {705 const title = document.querySelector('meta[property="og:title"]').content;706 const elements = document.querySelectorAll('.improvepage');707 const pageurl = window.location.href.split('?')[0];708 elements.forEach(element => {709 const url = new URL(element.href.split('?')[0].replace("-nojs", ""));710 url.searchParams.set('pagetitle', title);711 url.searchParams.set('pageurl', pageurl);712 url.searchParams.set('pagesource', "library/http.rst");713 element.href = url.toString();714 });715 });716 </script>717 <div role="note" aria-label="source link">718 <h3>This page</h3>719 <ul class="this-page-menu">720 <li><a href="../bugs.html">Report a bug</a></li>721 <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>722 <li>723 <a href="https://github.com/python/cpython/blob/main/Doc/library/http.rst?plain=1"724 rel="nofollow">Show source725 </a>726 </li>727 728 </ul>729 </div>730 </div>731<div id="sidebarbutton" title="Collapse sidebar">732<span>«</span>733</div>734 735 </div>736 <div class="clearer"></div>737 </div> 738 <div class="related" role="navigation" aria-label="Related">739 <h3>Navigation</h3>740 <ul>741 <li class="right" style="margin-right: 10px">742 <a href="../genindex.html" title="General Index"743 >index</a></li>744 <li class="right" >745 <a href="../py-modindex.html" title="Python Module Index"746 >modules</a> |</li>747 <li class="right" >748 <a href="http.client.html" title="http.client — HTTP protocol client"749 >next</a> |</li>750 <li class="right" >751 <a href="urllib.robotparser.html" title="urllib.robotparser — Parser for robots.txt"752 >previous</a> |</li>753 754 <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>755 <li><a href="https://www.python.org/">Python</a> »</li>756 <li class="switchers">757 <div class="language_switcher_placeholder"></div>758 <div class="version_switcher_placeholder"></div>759 </li>760 <li>761 762 </li>763 <li id="cpython-language-and-version">764 <a href="../index.html">3.15.0a6 Documentation</a> »765 </li>766 767 <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>768 <li class="nav-item nav-item-2"><a href="internet.html" >Internet Protocols and Support</a> »</li>769 <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">http</span></code> — HTTP modules</a></li>770 <li class="right">771 772 773 <div class="inline-search" role="search">774 <form class="inline-search" action="../search.html" method="get">775 <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">776 <input type="submit" value="Go">777 </form>778 </div>779 |780 </li>781 <li class="right">782<label class="theme-selector-label">783 Theme784 <select class="theme-selector" oninput="activateTheme(this.value)">785 <option value="auto" selected>Auto</option>786 <option value="light">Light</option>787 <option value="dark">Dark</option>788 </select>789</label> |</li>790 791 </ul>792 </div> 793 <div class="footer">794 © <a href="../copyright.html">Copyright</a> 2001 Python Software Foundation.795 <br>796 This page is licensed under the Python Software Foundation License Version 2.797 <br>798 Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.799 <br>800 801 See <a href="/license.html">History and License</a> for more information.<br>802 803 804 <br>805 806 The Python Software Foundation is a non-profit corporation.807<a href="https://www.python.org/psf/donations/">Please donate.</a>808<br>809 <br>810 Last updated on Mar 10, 2026 (08:58 UTC).811 812 <a href="/bugs.html">Found a bug</a>?813 814 <br>815 816 Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.817 </div>818 819 </body>820</html>