Unable to read http client content with python
I'm sorry if this is a misuse, but i never seem to get the actual content (always 0 sized). I'm using the documentation from http://lazka.github.io/pgi-docs/#Soup-2.4 as well as https://developer.gnome.org/libsoup/stable/libsoup-request-howto.html
I tried the same with messages, sync and async, getting the same result.
It looks like it's actually doing the request (because the status_code does work), but it seems to be impossible to get the result.
Am i missing something ?
import gi
gi.require_version('Soup', '2.4')
from gi.repository import Soup, GLib
def get():
session = Soup.Session()
request = session.request_http("GET", "https://www.gnome.org")
stream = request.send()
#message = request.get_message()
#print(message.status_code)
data = GLib.ByteArray.new()
bytes_read = stream.read(data)
print("Read %s bytes: %s" % (bytes_read, data))
ml = GLib.MainLoop()
GLib.idle_add(get)
ml.run()
python 3.7.0 libsoup: 2.64.1-1 python-gobject 3.30.1-3