On python 3.8, I created a minimalist python server for my students with BaseHTTPRequestHandler and HTTPServer from the module http.server
When I go to the url on the server, I see in the browser debug tool two http request :
- one for the page
- one for the favicon (the current head html page does not contains a link tag for a favicon, the current head is empty)
I want to prevent the second request (for favicon). My question is : with the classes "BaseHTTPRequestHandler" and "HTTPServer" is it possible to custom the header of the generated page ? I am looking for a way to add an empty favicon like this : <link rel="icon" href="data:;base64,="> (https://stackoverflow.com/a/13416784/2137454)

It is clearly possible. After all, you are in complete control of what your server sends to the client. However, I think you should not do this. Just serve that annoying little file favicon.ico. It is the easiest way:
To make this work, all you need to do is to place a png file in folder
staticand name itfavicon.ico.Of course, you could also modify the html content you are sending. As there is no code in your question, I hacked a little mock together:
Here I am assuming, you are serving a static file from the current directory. Before sending it to the client the
<link rel="icon">tag is appended right before the closing<head>tag. This will break easily, of course. But if you are indeed generating the html instead of serving a static file, placement of the linecontent += faviconin your code might be simple and save.