|
61 | 61 | # (Actually, the latter is only true if you know the server configuration |
62 | 62 | # at the time the request was made!) |
63 | 63 |
|
64 | | -__version__ = "0.6" |
65 | | - |
66 | 64 | __all__ = [ |
67 | 65 | "HTTPServer", "ThreadingHTTPServer", |
68 | 66 | "HTTPSServer", "ThreadingHTTPSServer", |
@@ -280,7 +278,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): |
280 | 278 | # The server software version. You may want to override this. |
281 | 279 | # The format is multiple whitespace-separated strings, |
282 | 280 | # where each string is of the form name[/version]. |
283 | | - server_version = "BaseHTTP/" + __version__ |
| 281 | + server_version = "BaseHTTP" |
284 | 282 |
|
285 | 283 | error_message_format = DEFAULT_ERROR_MESSAGE |
286 | 284 | error_content_type = DEFAULT_ERROR_CONTENT_TYPE |
@@ -690,7 +688,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): |
690 | 688 |
|
691 | 689 | """ |
692 | 690 |
|
693 | | - server_version = "SimpleHTTP/" + __version__ |
| 691 | + server_version = "SimpleHTTP" |
694 | 692 | index_pages = ("index.html", "index.htm") |
695 | 693 | extensions_map = _encodings_map_default = { |
696 | 694 | '.gz': 'application/gzip', |
@@ -1080,5 +1078,14 @@ class HTTPSDualStackServer(DualStackServerMixin, ThreadingHTTPSServer): |
1080 | 1078 | ) |
1081 | 1079 |
|
1082 | 1080 |
|
| 1081 | +def __getattr__(name): |
| 1082 | + if name == "__version__": |
| 1083 | + from warnings import _deprecated |
| 1084 | + |
| 1085 | + _deprecated("__version__", remove=(3, 20)) |
| 1086 | + return "0.6" # Do not change |
| 1087 | + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") |
| 1088 | + |
| 1089 | + |
1083 | 1090 | if __name__ == '__main__': |
1084 | 1091 | _main() |
0 commit comments