commit 78406b0c027c5d024abb4baec2df85831c926b6e
parent a27c8d6b1ea0f0948cf5278b2ebbd9522d24d555
Author: Joris Vink <joris@coders.se>
Date: Mon, 31 Aug 2020 11:03:49 +0200
Flesh out libcurl support.
Diffstat:
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/api/python.md b/api/python.md
@@ -73,8 +73,8 @@ koreapp = MyApp()
* [gather](#gather)
* [suspend](#suspend)
* [httpclient](#httpclient)
- * [curl](#curl)
* [dbsetup](#dbsetup) TODO
+ * [dbquery](#dbquery) TODO
* [websocket\_broadcast](#websocketbroadcast)
* [worker](#worker) TODO
* [setname](#setname) TODO
@@ -107,6 +107,10 @@ koreapp = MyApp()
* [Processes](#asyncproc)
+* [Asynchronous libcurl support](#curl)
+ * [curl](#curlhandle)
+ * [setopt](#curlsetopt)
+
# Kore {#koremodule}
## Constants {#koremoduleconstants}
@@ -567,6 +571,10 @@ Before you can use the client you must set it up.
**note** Kore must be built with CURL=1 for the curl handler to be included.
+---
+
+### Synopsis {#curlhandle}
+
```python
client = kore.curl(url)
```
@@ -591,6 +599,29 @@ data = await handle.run()
---
+### Synopsis {#curlsetopt}
+
+```python
+handle.setopt(option, value)
+```
+
+| Parameter | Description |
+| --- | --- |
+| option | The libcurl option to be set. |
+| value | The value to set the option to. |
+
+All libcurl constants are exported under the kore module directly.
+
+Example:
+```python
+handle.setopt(kore.CURLOPT_TIMEOUT, 10)
+```
+
+Depending on what the original option in libcurl takes the value must
+either be a string, an integer or a list.
+
+---
+
# websocket\_broadcast {#websocketbroadcast}
### Synopsis