sugar3.network module¶
STABLE.
- class sugar3.network.ChunkedGlibHTTPRequestHandler(request, client_address, server)¶
Bases:
http.server.SimpleHTTPRequestHandler
RequestHandler class that integrates with Glib mainloop. It writes the specified file to the client in chunks, returning control to the mainloop between chunks.
- CHUNK_SIZE = 4096¶
- do_GET()¶
Serve a GET request.
- finish()¶
Close the sockets when we’re done, not before
- log_request(code='-', size='-')¶
Log an accepted request.
This is called by send_response().
- send_head()¶
Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in which case the caller has nothing further to do.
** [dcbw] modified to send Content-disposition filename too
- class sugar3.network.GlibTCPServer(server_address, RequestHandlerClass)¶
Bases:
socketserver.TCPServer
Integrate socket accept into glib mainloop.
- allow_reuse_address = True¶
- close_request(request)¶
Called to clean up an individual request.
- request_queue_size = 20¶
- shutdown_request(request)¶
Called to shutdown and close an individual request.
- class sugar3.network.GlibURLDownloader(url, destdir=None)¶
Bases:
gi.overrides.GObject.Object
Grabs a URL in chunks, returning to the mainloop after each chunk
- CHUNK_SIZE = 4096¶
- cancel()¶
- cleanup(remove=False)¶
- start(destfile=None, destfd=None)¶
- sugar3.network.get_authinfo()¶