Skip to content

Doc: http.server: directory is not a class attribute, but an argument. #26017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Doc/library/http.server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,16 @@ provides three different variants:

.. class:: SimpleHTTPRequestHandler(request, client_address, server, directory=None)

This class serves files from the current directory and below, directly
This class serves files from the directory *directory* and below,
or the current directory if *directory* is not provided, directly
mapping the directory structure to HTTP requests.

.. versionadded:: 3.7
The *directory* parameter.

.. versionchanged:: 3.9
The *directory* parameter accepts a :term:`path-like object`.

A lot of the work, such as parsing the request, is done by the base class
:class:`BaseHTTPRequestHandler`. This class implements the :func:`do_GET`
and :func:`do_HEAD` functions.
Expand All @@ -345,13 +352,6 @@ provides three different variants:
This dictionary is no longer filled with the default system mappings,
but only contains overrides.

.. attribute:: directory

If not specified, the directory to serve is the current working directory.

.. versionchanged:: 3.9
Accepts a :term:`path-like object`.

The :class:`SimpleHTTPRequestHandler` class defines the following methods:

.. method:: do_HEAD()
Expand Down