From 5aa00499b004054521e0744b9746ea465638bd7b Mon Sep 17 00:00:00 2001 From: nishi Date: Fri, 9 Feb 2024 23:10:08 +0000 Subject: [PATCH] better git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@197 d27a3e52-49c5-7645-884c-6793ebffc270 --- Python/{ => LibW3}/__init__.py | 0 Python/test.py | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) rename Python/{ => LibW3}/__init__.py (100%) create mode 100644 Python/test.py 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() -- 2.43.0