From: nishi Date: Fri, 9 Feb 2024 23:10:08 +0000 (+0000) Subject: better X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=5aa00499b004054521e0744b9746ea465638bd7b;p=libw3.git better git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@197 d27a3e52-49c5-7645-884c-6793ebffc270 --- diff --git a/Python/__init__.py b/Python/LibW3/__init__.py similarity index 100% rename from Python/__init__.py rename to Python/LibW3/__init__.py diff --git a/Python/test.py b/Python/test.py new file mode 100644 index 0000000..804de01 --- /dev/null +++ b/Python/test.py @@ -0,0 +1,21 @@ +from LibW3 import w3, libw3 + +def data_handler(w3cli, data, size): + print(data) + +def header_handler(w3cli, key, value): + print("`" + key + "`: `" + value + "`") + +def status_handler(w3cli, status): + print("Status: " + str(status)) + +libw3.init() +w3cli = w3("http", "localhost", 1024) +w3cli.set_path("/") +w3cli.set_method("GET") +w3cli.set_data_handler(data_handler) +w3cli.set_header_handler(header_handler) +w3cli.set_status_handler(status_handler) +w3cli.set_read_size(2048) +w3cli.send_request() +w3cli.destroy()