1
0
mirror of https://git.kore.io/kore.git synced 2024-11-12 05:10:48 +01:00
kore/examples/python-async
Joris Vink 2c88bc6120 Add asynchronous libcurl support.
This commit adds the CURL=1 build option. When enabled allows
you to schedule CURL easy handles onto the Kore event loop.

It also adds an easy to use HTTP client API that abstracts away the
settings required from libcurl to make HTTP requests.

Tied together with HTTP request state machines this means you can
write fully asynchronous HTTP client requests in an easy way.

Additionally this exposes that API to the Python code as well
allowing you do to things like:

	client = kore.httpclient("https://kore.io")
	status, body = await client.get()

Introduces 2 configuration options:
	- curl_recv_max
		Max incoming bytes for a response.

	- curl_timeout
		Timeout in seconds before a transfer is cancelled.

This API also allows you to take the CURL easy handle and send emails
with it, run FTP, etc. All asynchronously.
2019-04-24 00:15:17 +02:00
..
conf Add asynchronous libcurl support. 2019-04-24 00:15:17 +02:00
src Add asynchronous libcurl support. 2019-04-24 00:15:17 +02:00
.gitignore Add python-async example. 2018-11-22 15:23:44 +01:00
README.md Add asynchronous libcurl support. 2019-04-24 00:15:17 +02:00

Kore python async/await examples.

This example also shows off the asynchronous HTTP client support and requires libcurl on your machine.

Run:

	$ kodev run

Test:

	$ curl -k http://127.0.0.1:8888/queue
	$ curl -k http://127.0.0.1:8888/lock
	$ curl -k http://127.0.0.1:8888/proc
	$ curl -k http://127.0.0.1:8888/socket
	$ curl -k http://127.0.0.1:8888/httpclient