aboutsummaryrefslogtreecommitdiffstats
path: root/typings
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-09-16 16:24:52 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commit0b46f31f14e9a69568535b2c73bc00fc396e2d71 (patch)
tree5aa4e44a92107d182da91543f784bebcedd53347 /typings
parent748991ae4d0bf3726b4a1eeb851b2d3a6446b2bb (diff)
downloadwee-slack-0b46f31f14e9a69568535b2c73bc00fc396e2d71.tar.gz
Use hook_url for http requests when available
Diffstat (limited to 'typings')
-rw-r--r--typings/weechat.pyi30
1 files changed, 29 insertions, 1 deletions
diff --git a/typings/weechat.pyi b/typings/weechat.pyi
index 49191fa..db2b5ce 100644
--- a/typings/weechat.pyi
+++ b/typings/weechat.pyi
@@ -1362,6 +1362,32 @@ def hook_process_hashtable(command: str, options: Dict[str, str], timeout: int,
...
+def hook_url(url: str, options: Dict[str, str], timeout: int, callback: str, callback_data: str) -> str:
+ """`hook_url in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_url>`_
+ ::
+
+ # example
+ def my_url_cb(data: str, url: str, options: Dict[str, str], output: Dict[str, str]) -> int:
+ weechat.prnt("", "output: %s" % output)
+ return weechat.WEECHAT_RC_OK
+
+ # example 1: output to a file
+ hook1 = weechat.hook_url("https://weechat.org/",
+ {"file_out": "/tmp/weechat.org.html"},
+ 20000, "my_url_cb", "")
+
+ # example 2: custom HTTP headers, output sent to callback
+ options = {
+ "httpheader": "\n".join([
+ "Header1: value1",
+ "Header2: value2",
+ ]),
+ }
+ hook2 = weechat.hook_url("http://localhost:8080/", options, 20000, "my_url_cb", "")
+ """
+ ...
+
+
def hook_connect(proxy: str, address: str, port: int, ipv6: int, retry: int, local_hostname: str,
callback: str, callback_data: str) -> str:
"""`hook_connect in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_connect>`_
@@ -2661,7 +2687,9 @@ def hdata_compare(hdata: str, pointer1: str, pointer2: str, name: str, case_sens
hdata = weechat.hdata_get("buffer")
buffer1 = weechat.buffer_search("irc", "libera.#weechat")
buffer2 = weechat.buffer_search("irc", "libera.#weechat-fr")
- weechat.prnt("", "number comparison = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
+ weechat.prnt("", "comparison of buffer number = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
+ weechat.prnt("", "comparison of number of lines = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "own_lines.lines_count", 0))
+ weechat.prnt("", "comparison of local variable = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "local_variables.myvar", 0))
"""
...