Read geopackage to python

Hello everyone,

I’m new to the community and to the Kobo API. I am working on a pipeline to get data collected through Kobo forms and generate automated reports. I am now attempting to retrieve spatial data from Kobo using python.

So far, the link and filename in attachments are the only access points I have identified, but I have only got 404 responses so far.

>>> print(dwl_url)
https://kf.kobotoolbox.org/api/v2/assets/aCzNHAjxNHjtf4EdfTMHvQ/data/AAAAAAA/attachments/BBBBBB/
>>> response = requests.get(dwl_url, allow_redirects=True)
>>> response.status_code
404

Even though I would prefer to not download the file, but rather reading it directly to python, I have tried the urlretrieve path, without success.

>>>destination_file = os.path.join(os.environ.get('HOME'), 'test.gpkg')
>>>urllib.request.urlretrieve(dwl_url, destination_file)
urllib.error.HTTPError: HTTP Error 404: Not Found

Does anyone know a practical way to retrieve spatial data through the API?

Thank you

Ivan