kobo-api-v2 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kobo_api_v2-0.1.0/.github/workflows/publish.yml +26 -0
- kobo_api_v2-0.1.0/.gitignore +11 -0
- kobo_api_v2-0.1.0/LICENSE +21 -0
- kobo_api_v2-0.1.0/PKG-INFO +230 -0
- kobo_api_v2-0.1.0/README.md +203 -0
- kobo_api_v2-0.1.0/kobo/__init__.py +4 -0
- kobo_api_v2-0.1.0/kobo/client.py +350 -0
- kobo_api_v2-0.1.0/pyproject.toml +40 -0
- kobo_api_v2-0.1.0/uv.lock +110 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v5
|
|
19
|
+
|
|
20
|
+
- name: Build
|
|
21
|
+
run: uv build
|
|
22
|
+
|
|
23
|
+
- name: Publish
|
|
24
|
+
run: uv publish
|
|
25
|
+
env:
|
|
26
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Diego Mora
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kobo-api-v2
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A synchronous Python client for the KoboToolbox API v2
|
|
5
|
+
Project-URL: Homepage, https://github.com/morabdiego/kobo-api-v2
|
|
6
|
+
Project-URL: Repository, https://github.com/morabdiego/kobo-api-v2
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/morabdiego/kobo-api-v2/issues
|
|
8
|
+
Author-email: Diego Mora <morabdiego@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: api,data-collection,kobo,kobotoolbox,survey,xlsform
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: requests>=2.32
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Kobo API v2 Python client
|
|
29
|
+
|
|
30
|
+
[](https://pypi.org/project/kobo-api-v2/)
|
|
31
|
+
[](https://pypi.org/project/kobo-api-v2/)
|
|
32
|
+
[](https://opensource.org/licenses/MIT)
|
|
33
|
+
|
|
34
|
+
A lightweight, synchronous Python client for the [KoboToolbox API v2](https://kf.kobotoolbox.org/api/v2/docs/).
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install kobo-api-v2
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Requires Python ≥ 3.10.
|
|
43
|
+
|
|
44
|
+
## Quick start
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from kobo import KoboClient
|
|
48
|
+
|
|
49
|
+
client = KoboClient(api_token="<your_api_token>")
|
|
50
|
+
|
|
51
|
+
# List available surveys
|
|
52
|
+
surveys = client.get_surveys()
|
|
53
|
+
|
|
54
|
+
# Download the first survey as Excel in one call
|
|
55
|
+
saved = client.get_excel(surveys[0]["uid"])
|
|
56
|
+
print(saved) # → /absolute/path/to/data_survey.xlsx
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Your API token is under **Account Settings → Security → API key** in your KoboToolbox account.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## API reference
|
|
64
|
+
|
|
65
|
+
### `KoboClient(api_token, base_url=...)`
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
# Public server (default)
|
|
69
|
+
client = KoboClient(api_token="...")
|
|
70
|
+
|
|
71
|
+
# Self-hosted instance
|
|
72
|
+
client = KoboClient(api_token="...", base_url="https://kobo.myserver.org")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Surveys
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
# List surveys (returns list[dict] with uid, name, deployment_status, …)
|
|
81
|
+
surveys = client.get_surveys()
|
|
82
|
+
surveys = client.get_surveys(search="census", limit=50, offset=0)
|
|
83
|
+
|
|
84
|
+
# Full metadata for a single survey
|
|
85
|
+
survey = client.get_survey(uid)
|
|
86
|
+
|
|
87
|
+
# XLSForm content (survey, choices, settings sections)
|
|
88
|
+
content = client.get_survey_content(uid)
|
|
89
|
+
for row in content["survey"]:
|
|
90
|
+
print(row["type"], row.get("$autoname"))
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### `get_surveys` parameters
|
|
94
|
+
|
|
95
|
+
| Parameter | Default | Description |
|
|
96
|
+
|-----------|---------|-------------|
|
|
97
|
+
| `limit` | `100` | Results per page (API max: 300) |
|
|
98
|
+
| `offset` | `0` | Pagination offset |
|
|
99
|
+
| `search` | `None` | Free-text filter |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### `get_excel` — one-call export
|
|
104
|
+
|
|
105
|
+
Download survey data as an Excel file with a single method call:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
# Minimal — saves to data_survey.xlsx in the current directory
|
|
109
|
+
saved = client.get_excel(uid)
|
|
110
|
+
|
|
111
|
+
# Custom output path
|
|
112
|
+
saved = client.get_excel(uid, path="outputs/survey.xlsx")
|
|
113
|
+
|
|
114
|
+
# Reuse an already-triggered export task
|
|
115
|
+
saved = client.get_excel(uid, export_uid="eNHpF8SxT9oP2752mj8UJQ")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
When `export_uid` is omitted the method:
|
|
119
|
+
1. Creates (or reuses) a saved export setting named `"python-client"`
|
|
120
|
+
2. Triggers a new XLS export using XLSForm internal field names (`lang="_xml"`)
|
|
121
|
+
3. Polls until the server finishes generating the file (every 3 s, 120 s timeout)
|
|
122
|
+
4. Downloads the file and returns its absolute `Path`
|
|
123
|
+
|
|
124
|
+
| Parameter | Default | Description |
|
|
125
|
+
|-----------|---------|-------------|
|
|
126
|
+
| `asset_uid` | — | Survey UID |
|
|
127
|
+
| `export_uid` | `None` | UID of an already-triggered export; triggers a new one if omitted |
|
|
128
|
+
| `path` | `"data_survey.xlsx"` | Local destination path |
|
|
129
|
+
| `poll_interval` | `3.0` | Seconds between status checks |
|
|
130
|
+
| `timeout` | `120.0` | Max seconds to wait before raising `ExportTimeoutError` |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### Export settings (reusable configurations)
|
|
135
|
+
|
|
136
|
+
Export settings are named configurations saved in KoboToolbox that can be reused across multiple exports.
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
# Create a new setting (raises KoboError if the name already exists)
|
|
140
|
+
setting_uid = client.create_export_setting(uid, name="my_config")
|
|
141
|
+
|
|
142
|
+
# Create or reuse — recommended for recurring scripts
|
|
143
|
+
setting_uid, created = client.get_or_create_export_setting(uid, name="my_config")
|
|
144
|
+
|
|
145
|
+
# List all saved settings for a survey
|
|
146
|
+
settings = client.list_export_settings(uid)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
All settings default to the values below and can be overridden with `**overrides`:
|
|
150
|
+
|
|
151
|
+
| Field | Default | Description |
|
|
152
|
+
|-------|---------|-------------|
|
|
153
|
+
| `type` | `"xls"` | Format: `"xls"`, `"csv"`, `"geojson"` |
|
|
154
|
+
| `lang` | `"_xml"` | `"_xml"` = XLSForm internal names; or a language label, e.g. `"English"` |
|
|
155
|
+
| `fields_from_all_versions` | `True` | Include fields from older form versions |
|
|
156
|
+
| `group_sep` | `"/"` | Column name separator for groups |
|
|
157
|
+
| `hierarchy_in_labels` | `False` | Prepend group hierarchy to labels |
|
|
158
|
+
| `multiple_select` | `"summary"` | `"summary"`, `"both"`, or `"details"` |
|
|
159
|
+
| `flatten` | `False` | Flatten group structure |
|
|
160
|
+
| `xls_types_as_text` | `False` | Export all values as strings |
|
|
161
|
+
| `include_media_url` | `False` | Include attachment download URLs |
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
setting_uid = client.create_export_setting(
|
|
165
|
+
uid,
|
|
166
|
+
name="csv_english",
|
|
167
|
+
type="csv",
|
|
168
|
+
lang="English",
|
|
169
|
+
)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### Async exports (manual control)
|
|
175
|
+
|
|
176
|
+
For full control over the export lifecycle:
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
# 1. Trigger an export task
|
|
180
|
+
export_uid = client.trigger_export(uid, type="xls", lang="_xml")
|
|
181
|
+
|
|
182
|
+
# Filter by date
|
|
183
|
+
export_uid = client.trigger_export(
|
|
184
|
+
uid,
|
|
185
|
+
query={"$and": [{"_submission_time": {"$gte": "2024-01-01"}}]},
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
# Specific submissions or fields
|
|
189
|
+
export_uid = client.trigger_export(uid, submission_ids=[101, 102])
|
|
190
|
+
export_uid = client.trigger_export(uid, fields=["name", "age"])
|
|
191
|
+
|
|
192
|
+
# 2. Wait and get the download URL
|
|
193
|
+
result = client.wait_for_export(uid, export_uid)
|
|
194
|
+
print(result["result"]) # direct download URL
|
|
195
|
+
|
|
196
|
+
# 3. Or wait and download in one step
|
|
197
|
+
saved = client.download_export(uid, export_uid, dest_path="data/survey.xlsx")
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
| Method | Returns |
|
|
201
|
+
|--------|---------|
|
|
202
|
+
| `trigger_export(uid, ...)` | `export_uid: str` |
|
|
203
|
+
| `wait_for_export(uid, export_uid)` | `dict` with `result` (download URL) |
|
|
204
|
+
| `download_export(uid, export_uid, path)` | `Path` of the saved file |
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Error handling
|
|
209
|
+
|
|
210
|
+
| Exception | Raised when |
|
|
211
|
+
|-----------|-------------|
|
|
212
|
+
| `KoboError` | The API returns an HTTP error (4xx / 5xx) |
|
|
213
|
+
| `ExportTimeoutError` | Export did not complete within `timeout` seconds |
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
from kobo.client import KoboError, ExportTimeoutError
|
|
217
|
+
|
|
218
|
+
try:
|
|
219
|
+
saved = client.get_excel(uid, path="out.xlsx")
|
|
220
|
+
except ExportTimeoutError:
|
|
221
|
+
print("Export took too long")
|
|
222
|
+
except KoboError as e:
|
|
223
|
+
print(f"API error: {e}")
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Kobo API v2 Python client
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/kobo-api-v2/)
|
|
4
|
+
[](https://pypi.org/project/kobo-api-v2/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
A lightweight, synchronous Python client for the [KoboToolbox API v2](https://kf.kobotoolbox.org/api/v2/docs/).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install kobo-api-v2
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires Python ≥ 3.10.
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from kobo import KoboClient
|
|
21
|
+
|
|
22
|
+
client = KoboClient(api_token="<your_api_token>")
|
|
23
|
+
|
|
24
|
+
# List available surveys
|
|
25
|
+
surveys = client.get_surveys()
|
|
26
|
+
|
|
27
|
+
# Download the first survey as Excel in one call
|
|
28
|
+
saved = client.get_excel(surveys[0]["uid"])
|
|
29
|
+
print(saved) # → /absolute/path/to/data_survey.xlsx
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Your API token is under **Account Settings → Security → API key** in your KoboToolbox account.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## API reference
|
|
37
|
+
|
|
38
|
+
### `KoboClient(api_token, base_url=...)`
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
# Public server (default)
|
|
42
|
+
client = KoboClient(api_token="...")
|
|
43
|
+
|
|
44
|
+
# Self-hosted instance
|
|
45
|
+
client = KoboClient(api_token="...", base_url="https://kobo.myserver.org")
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
### Surveys
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
# List surveys (returns list[dict] with uid, name, deployment_status, …)
|
|
54
|
+
surveys = client.get_surveys()
|
|
55
|
+
surveys = client.get_surveys(search="census", limit=50, offset=0)
|
|
56
|
+
|
|
57
|
+
# Full metadata for a single survey
|
|
58
|
+
survey = client.get_survey(uid)
|
|
59
|
+
|
|
60
|
+
# XLSForm content (survey, choices, settings sections)
|
|
61
|
+
content = client.get_survey_content(uid)
|
|
62
|
+
for row in content["survey"]:
|
|
63
|
+
print(row["type"], row.get("$autoname"))
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### `get_surveys` parameters
|
|
67
|
+
|
|
68
|
+
| Parameter | Default | Description |
|
|
69
|
+
|-----------|---------|-------------|
|
|
70
|
+
| `limit` | `100` | Results per page (API max: 300) |
|
|
71
|
+
| `offset` | `0` | Pagination offset |
|
|
72
|
+
| `search` | `None` | Free-text filter |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### `get_excel` — one-call export
|
|
77
|
+
|
|
78
|
+
Download survey data as an Excel file with a single method call:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
# Minimal — saves to data_survey.xlsx in the current directory
|
|
82
|
+
saved = client.get_excel(uid)
|
|
83
|
+
|
|
84
|
+
# Custom output path
|
|
85
|
+
saved = client.get_excel(uid, path="outputs/survey.xlsx")
|
|
86
|
+
|
|
87
|
+
# Reuse an already-triggered export task
|
|
88
|
+
saved = client.get_excel(uid, export_uid="eNHpF8SxT9oP2752mj8UJQ")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
When `export_uid` is omitted the method:
|
|
92
|
+
1. Creates (or reuses) a saved export setting named `"python-client"`
|
|
93
|
+
2. Triggers a new XLS export using XLSForm internal field names (`lang="_xml"`)
|
|
94
|
+
3. Polls until the server finishes generating the file (every 3 s, 120 s timeout)
|
|
95
|
+
4. Downloads the file and returns its absolute `Path`
|
|
96
|
+
|
|
97
|
+
| Parameter | Default | Description |
|
|
98
|
+
|-----------|---------|-------------|
|
|
99
|
+
| `asset_uid` | — | Survey UID |
|
|
100
|
+
| `export_uid` | `None` | UID of an already-triggered export; triggers a new one if omitted |
|
|
101
|
+
| `path` | `"data_survey.xlsx"` | Local destination path |
|
|
102
|
+
| `poll_interval` | `3.0` | Seconds between status checks |
|
|
103
|
+
| `timeout` | `120.0` | Max seconds to wait before raising `ExportTimeoutError` |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### Export settings (reusable configurations)
|
|
108
|
+
|
|
109
|
+
Export settings are named configurations saved in KoboToolbox that can be reused across multiple exports.
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
# Create a new setting (raises KoboError if the name already exists)
|
|
113
|
+
setting_uid = client.create_export_setting(uid, name="my_config")
|
|
114
|
+
|
|
115
|
+
# Create or reuse — recommended for recurring scripts
|
|
116
|
+
setting_uid, created = client.get_or_create_export_setting(uid, name="my_config")
|
|
117
|
+
|
|
118
|
+
# List all saved settings for a survey
|
|
119
|
+
settings = client.list_export_settings(uid)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
All settings default to the values below and can be overridden with `**overrides`:
|
|
123
|
+
|
|
124
|
+
| Field | Default | Description |
|
|
125
|
+
|-------|---------|-------------|
|
|
126
|
+
| `type` | `"xls"` | Format: `"xls"`, `"csv"`, `"geojson"` |
|
|
127
|
+
| `lang` | `"_xml"` | `"_xml"` = XLSForm internal names; or a language label, e.g. `"English"` |
|
|
128
|
+
| `fields_from_all_versions` | `True` | Include fields from older form versions |
|
|
129
|
+
| `group_sep` | `"/"` | Column name separator for groups |
|
|
130
|
+
| `hierarchy_in_labels` | `False` | Prepend group hierarchy to labels |
|
|
131
|
+
| `multiple_select` | `"summary"` | `"summary"`, `"both"`, or `"details"` |
|
|
132
|
+
| `flatten` | `False` | Flatten group structure |
|
|
133
|
+
| `xls_types_as_text` | `False` | Export all values as strings |
|
|
134
|
+
| `include_media_url` | `False` | Include attachment download URLs |
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
setting_uid = client.create_export_setting(
|
|
138
|
+
uid,
|
|
139
|
+
name="csv_english",
|
|
140
|
+
type="csv",
|
|
141
|
+
lang="English",
|
|
142
|
+
)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### Async exports (manual control)
|
|
148
|
+
|
|
149
|
+
For full control over the export lifecycle:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
# 1. Trigger an export task
|
|
153
|
+
export_uid = client.trigger_export(uid, type="xls", lang="_xml")
|
|
154
|
+
|
|
155
|
+
# Filter by date
|
|
156
|
+
export_uid = client.trigger_export(
|
|
157
|
+
uid,
|
|
158
|
+
query={"$and": [{"_submission_time": {"$gte": "2024-01-01"}}]},
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
# Specific submissions or fields
|
|
162
|
+
export_uid = client.trigger_export(uid, submission_ids=[101, 102])
|
|
163
|
+
export_uid = client.trigger_export(uid, fields=["name", "age"])
|
|
164
|
+
|
|
165
|
+
# 2. Wait and get the download URL
|
|
166
|
+
result = client.wait_for_export(uid, export_uid)
|
|
167
|
+
print(result["result"]) # direct download URL
|
|
168
|
+
|
|
169
|
+
# 3. Or wait and download in one step
|
|
170
|
+
saved = client.download_export(uid, export_uid, dest_path="data/survey.xlsx")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
| Method | Returns |
|
|
174
|
+
|--------|---------|
|
|
175
|
+
| `trigger_export(uid, ...)` | `export_uid: str` |
|
|
176
|
+
| `wait_for_export(uid, export_uid)` | `dict` with `result` (download URL) |
|
|
177
|
+
| `download_export(uid, export_uid, path)` | `Path` of the saved file |
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Error handling
|
|
182
|
+
|
|
183
|
+
| Exception | Raised when |
|
|
184
|
+
|-----------|-------------|
|
|
185
|
+
| `KoboError` | The API returns an HTTP error (4xx / 5xx) |
|
|
186
|
+
| `ExportTimeoutError` | Export did not complete within `timeout` seconds |
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from kobo.client import KoboError, ExportTimeoutError
|
|
190
|
+
|
|
191
|
+
try:
|
|
192
|
+
saved = client.get_excel(uid, path="out.xlsx")
|
|
193
|
+
except ExportTimeoutError:
|
|
194
|
+
print("Export took too long")
|
|
195
|
+
except KoboError as e:
|
|
196
|
+
print(f"API error: {e}")
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"""KoboToolbox API v2 client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import time
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
import requests
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
BASE_URL = "https://kf.kobotoolbox.org"
|
|
13
|
+
|
|
14
|
+
# Default export settings that use XLSForm internal names (lang=_xml)
|
|
15
|
+
# Keys accepted by /export-settings/ (reusable config)
|
|
16
|
+
_DEFAULT_EXPORT_SETTING_KEYS: dict[str, Any] = {
|
|
17
|
+
"type": "xls",
|
|
18
|
+
"fields_from_all_versions": True,
|
|
19
|
+
"group_sep": "/",
|
|
20
|
+
"hierarchy_in_labels": False,
|
|
21
|
+
"lang": "_xml",
|
|
22
|
+
"multiple_select": "summary",
|
|
23
|
+
"flatten": False,
|
|
24
|
+
"xls_types_as_text": False,
|
|
25
|
+
"include_media_url": False,
|
|
26
|
+
"fields": [],
|
|
27
|
+
"query": {},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# Keys for one-off async /exports/ (superset — allows filtering by submission IDs)
|
|
31
|
+
_DEFAULT_EXPORT_PAYLOAD: dict[str, Any] = {
|
|
32
|
+
**_DEFAULT_EXPORT_SETTING_KEYS,
|
|
33
|
+
"submission_ids": [],
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class KoboError(Exception):
|
|
38
|
+
"""Raised when the KoboToolbox API returns an error response."""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class ExportTimeoutError(KoboError):
|
|
42
|
+
"""Raised when waiting for an export exceeds the timeout."""
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class KoboClient:
|
|
46
|
+
"""Simple synchronous client for the KoboToolbox API v2.
|
|
47
|
+
|
|
48
|
+
Parameters
|
|
49
|
+
----------
|
|
50
|
+
api_token:
|
|
51
|
+
KoboToolbox API token (found in Account Settings → Security).
|
|
52
|
+
base_url:
|
|
53
|
+
Base URL of the KoboToolbox instance.
|
|
54
|
+
Defaults to the public server ``https://kf.kobotoolbox.org``.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
def __init__(
|
|
58
|
+
self,
|
|
59
|
+
api_token: str,
|
|
60
|
+
base_url: str = BASE_URL,
|
|
61
|
+
) -> None:
|
|
62
|
+
self._base = base_url.rstrip("/")
|
|
63
|
+
self._session = requests.Session()
|
|
64
|
+
self._session.headers.update(
|
|
65
|
+
{
|
|
66
|
+
"Authorization": f"Token {api_token}",
|
|
67
|
+
"Accept": "application/json",
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# ------------------------------------------------------------------
|
|
72
|
+
# Internal helpers
|
|
73
|
+
# ------------------------------------------------------------------
|
|
74
|
+
|
|
75
|
+
def _url(self, path: str) -> str:
|
|
76
|
+
return f"{self._base}{path}"
|
|
77
|
+
|
|
78
|
+
def _raise_for_status(self, response: requests.Response) -> None:
|
|
79
|
+
if not response.ok:
|
|
80
|
+
try:
|
|
81
|
+
detail = response.json()
|
|
82
|
+
except Exception:
|
|
83
|
+
detail = response.text
|
|
84
|
+
raise KoboError(
|
|
85
|
+
f"HTTP {response.status_code} {response.request.url}: {detail}"
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
def _get(self, path: str, **params: Any) -> Any:
|
|
89
|
+
resp = self._session.get(self._url(path), params=params or None)
|
|
90
|
+
self._raise_for_status(resp)
|
|
91
|
+
return resp.json()
|
|
92
|
+
|
|
93
|
+
def _post(self, path: str, payload: dict[str, Any]) -> Any:
|
|
94
|
+
resp = self._session.post(self._url(path), json=payload)
|
|
95
|
+
self._raise_for_status(resp)
|
|
96
|
+
return resp.json()
|
|
97
|
+
|
|
98
|
+
# ------------------------------------------------------------------
|
|
99
|
+
# Surveys (assets of type "survey")
|
|
100
|
+
# ------------------------------------------------------------------
|
|
101
|
+
|
|
102
|
+
def get_surveys(
|
|
103
|
+
self,
|
|
104
|
+
limit: int = 100,
|
|
105
|
+
offset: int = 0,
|
|
106
|
+
search: str | None = None,
|
|
107
|
+
) -> list[dict[str, Any]]:
|
|
108
|
+
"""Return a list of survey assets for the authenticated user.
|
|
109
|
+
|
|
110
|
+
Parameters
|
|
111
|
+
----------
|
|
112
|
+
limit: Max results per page (API max: 300).
|
|
113
|
+
offset: Pagination offset.
|
|
114
|
+
search: Optional free-text search query.
|
|
115
|
+
|
|
116
|
+
Returns a list of dicts with keys such as ``uid``, ``name``,
|
|
117
|
+
``deployment_status``, ``date_modified``, etc.
|
|
118
|
+
"""
|
|
119
|
+
params: dict[str, Any] = {
|
|
120
|
+
"asset_type": "survey",
|
|
121
|
+
"limit": limit,
|
|
122
|
+
"offset": offset,
|
|
123
|
+
}
|
|
124
|
+
if search:
|
|
125
|
+
params["q"] = search
|
|
126
|
+
data = self._get("/api/v2/assets/", **params)
|
|
127
|
+
return data.get("results", [])
|
|
128
|
+
|
|
129
|
+
def get_survey(self, uid: str) -> dict[str, Any]:
|
|
130
|
+
"""Return full details for a single survey asset."""
|
|
131
|
+
return self._get(f"/api/v2/assets/{uid}/")
|
|
132
|
+
|
|
133
|
+
def get_survey_content(self, uid: str) -> dict[str, Any]:
|
|
134
|
+
"""Return the XLSForm content of a survey (survey, choices, settings)."""
|
|
135
|
+
return self._get(f"/api/v2/assets/{uid}/content/")
|
|
136
|
+
|
|
137
|
+
# ------------------------------------------------------------------
|
|
138
|
+
# Export settings (reusable configurations)
|
|
139
|
+
# ------------------------------------------------------------------
|
|
140
|
+
|
|
141
|
+
def get_or_create_export_setting(
|
|
142
|
+
self,
|
|
143
|
+
asset_uid: str,
|
|
144
|
+
name: str,
|
|
145
|
+
**overrides: Any,
|
|
146
|
+
) -> tuple[str, bool]:
|
|
147
|
+
"""Return the uid of an export setting with the given name, creating it if needed.
|
|
148
|
+
|
|
149
|
+
Parameters
|
|
150
|
+
----------
|
|
151
|
+
asset_uid: UID of the survey asset.
|
|
152
|
+
name: Display name for the setting.
|
|
153
|
+
**overrides:
|
|
154
|
+
Any key from ``export_settings`` to override the defaults.
|
|
155
|
+
|
|
156
|
+
Returns a ``(uid, created)`` tuple where ``created`` is ``True`` if
|
|
157
|
+
the setting was newly created, or ``False`` if an existing one was found.
|
|
158
|
+
"""
|
|
159
|
+
for setting in self.list_export_settings(asset_uid):
|
|
160
|
+
if setting.get("name") == name:
|
|
161
|
+
return setting["uid"], False
|
|
162
|
+
|
|
163
|
+
uid = self.create_export_setting(asset_uid, name, **overrides)
|
|
164
|
+
return uid, True
|
|
165
|
+
|
|
166
|
+
def create_export_setting(
|
|
167
|
+
self,
|
|
168
|
+
asset_uid: str,
|
|
169
|
+
name: str,
|
|
170
|
+
**overrides: Any,
|
|
171
|
+
) -> str:
|
|
172
|
+
"""Create a named export setting for an asset and return its uid.
|
|
173
|
+
|
|
174
|
+
Parameters
|
|
175
|
+
----------
|
|
176
|
+
asset_uid: UID of the survey asset.
|
|
177
|
+
name: Display name for the setting.
|
|
178
|
+
**overrides:
|
|
179
|
+
Any key from ``export_settings`` to override the defaults.
|
|
180
|
+
Defaults use ``lang="_xml"`` (XLSForm internal field names)
|
|
181
|
+
and ``type="xls"``.
|
|
182
|
+
|
|
183
|
+
Returns the ``uid`` of the created export setting.
|
|
184
|
+
Raises :exc:`KoboError` if a setting with the same name already exists.
|
|
185
|
+
Use :meth:`get_or_create_export_setting` to avoid that error.
|
|
186
|
+
"""
|
|
187
|
+
settings = {**_DEFAULT_EXPORT_SETTING_KEYS, **overrides}
|
|
188
|
+
payload: dict[str, Any] = {
|
|
189
|
+
"name": name,
|
|
190
|
+
"export_settings": settings,
|
|
191
|
+
}
|
|
192
|
+
data = self._post(f"/api/v2/assets/{asset_uid}/export-settings/", payload)
|
|
193
|
+
return data["uid"]
|
|
194
|
+
|
|
195
|
+
def list_export_settings(self, asset_uid: str) -> list[dict[str, Any]]:
|
|
196
|
+
"""Return all saved export settings for an asset."""
|
|
197
|
+
data = self._get(f"/api/v2/assets/{asset_uid}/export-settings/")
|
|
198
|
+
return data.get("results", [])
|
|
199
|
+
|
|
200
|
+
# ------------------------------------------------------------------
|
|
201
|
+
# Async exports (trigger → poll → download)
|
|
202
|
+
# ------------------------------------------------------------------
|
|
203
|
+
|
|
204
|
+
def trigger_export(
|
|
205
|
+
self,
|
|
206
|
+
asset_uid: str,
|
|
207
|
+
type: str = "xls",
|
|
208
|
+
lang: str = "_xml",
|
|
209
|
+
**overrides: Any,
|
|
210
|
+
) -> str:
|
|
211
|
+
"""Trigger an async export task and return its ``uid``.
|
|
212
|
+
|
|
213
|
+
Parameters
|
|
214
|
+
----------
|
|
215
|
+
asset_uid: UID of the survey asset.
|
|
216
|
+
type: Export format — ``"xls"``, ``"csv"``, ``"geojson"``, etc.
|
|
217
|
+
lang: Language for labels. ``"_xml"`` uses XLSForm field names.
|
|
218
|
+
**overrides:
|
|
219
|
+
Extra ``ExportCreatePayload`` fields (e.g. ``fields``,
|
|
220
|
+
``query``, ``submissions_id``).
|
|
221
|
+
|
|
222
|
+
Returns the ``uid`` of the export task. Use :meth:`wait_for_export`
|
|
223
|
+
to poll for completion.
|
|
224
|
+
"""
|
|
225
|
+
payload: dict[str, Any] = {
|
|
226
|
+
**_DEFAULT_EXPORT_PAYLOAD,
|
|
227
|
+
"type": type,
|
|
228
|
+
"lang": lang,
|
|
229
|
+
**overrides,
|
|
230
|
+
}
|
|
231
|
+
data = self._post(f"/api/v2/assets/{asset_uid}/exports/", payload)
|
|
232
|
+
return data["uid"]
|
|
233
|
+
|
|
234
|
+
def wait_for_export(
|
|
235
|
+
self,
|
|
236
|
+
asset_uid: str,
|
|
237
|
+
export_uid: str,
|
|
238
|
+
poll_interval: float = 3.0,
|
|
239
|
+
timeout: float = 120.0,
|
|
240
|
+
) -> dict[str, Any]:
|
|
241
|
+
"""Poll until an export task is complete and return the response dict.
|
|
242
|
+
|
|
243
|
+
The returned dict includes a ``result`` key with the direct download URL.
|
|
244
|
+
|
|
245
|
+
Parameters
|
|
246
|
+
----------
|
|
247
|
+
asset_uid: UID of the survey asset.
|
|
248
|
+
export_uid: UID of the export task (from :meth:`trigger_export`).
|
|
249
|
+
poll_interval: Seconds between status checks.
|
|
250
|
+
timeout: Maximum seconds to wait before raising
|
|
251
|
+
:exc:`ExportTimeoutError`.
|
|
252
|
+
"""
|
|
253
|
+
path = f"/api/v2/assets/{asset_uid}/exports/{export_uid}/"
|
|
254
|
+
deadline = time.monotonic() + timeout
|
|
255
|
+
|
|
256
|
+
while True:
|
|
257
|
+
data = self._get(path)
|
|
258
|
+
status = data.get("status", "")
|
|
259
|
+
|
|
260
|
+
if status == "complete":
|
|
261
|
+
return data
|
|
262
|
+
if status == "error":
|
|
263
|
+
raise KoboError(
|
|
264
|
+
f"Export {export_uid} failed: {data.get('message', 'unknown error')}"
|
|
265
|
+
)
|
|
266
|
+
if time.monotonic() >= deadline:
|
|
267
|
+
raise ExportTimeoutError(
|
|
268
|
+
f"Export {export_uid} did not complete within {timeout}s "
|
|
269
|
+
f"(last status: {status!r})"
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
time.sleep(poll_interval)
|
|
273
|
+
|
|
274
|
+
def download_export(
|
|
275
|
+
self,
|
|
276
|
+
asset_uid: str,
|
|
277
|
+
export_uid: str,
|
|
278
|
+
dest_path: str | Path,
|
|
279
|
+
poll_interval: float = 3.0,
|
|
280
|
+
timeout: float = 120.0,
|
|
281
|
+
) -> Path:
|
|
282
|
+
"""Wait for an export to complete, then download the file.
|
|
283
|
+
|
|
284
|
+
Parameters
|
|
285
|
+
----------
|
|
286
|
+
asset_uid: UID of the survey asset.
|
|
287
|
+
export_uid: UID of the export task (from :meth:`trigger_export`).
|
|
288
|
+
dest_path: Local path to save the downloaded file.
|
|
289
|
+
poll_interval: Seconds between status checks while waiting.
|
|
290
|
+
timeout: Maximum seconds to wait for the export to finish.
|
|
291
|
+
|
|
292
|
+
Returns the resolved :class:`~pathlib.Path` of the saved file.
|
|
293
|
+
"""
|
|
294
|
+
result = self.wait_for_export(asset_uid, export_uid, poll_interval, timeout)
|
|
295
|
+
download_url: str = result["result"]
|
|
296
|
+
|
|
297
|
+
dest = Path(dest_path)
|
|
298
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
299
|
+
|
|
300
|
+
with self._session.get(download_url, stream=True) as resp:
|
|
301
|
+
self._raise_for_status(resp)
|
|
302
|
+
with dest.open("wb") as fh:
|
|
303
|
+
for chunk in resp.iter_content(chunk_size=8192):
|
|
304
|
+
fh.write(chunk)
|
|
305
|
+
|
|
306
|
+
return dest.resolve()
|
|
307
|
+
|
|
308
|
+
# ------------------------------------------------------------------
|
|
309
|
+
# High-level shortcut
|
|
310
|
+
# ------------------------------------------------------------------
|
|
311
|
+
|
|
312
|
+
def get_excel(
|
|
313
|
+
self,
|
|
314
|
+
asset_uid: str,
|
|
315
|
+
export_uid: str | None = None,
|
|
316
|
+
path: str | Path = "data_survey.xlsx",
|
|
317
|
+
poll_interval: float = 3.0,
|
|
318
|
+
timeout: float = 120.0,
|
|
319
|
+
) -> Path:
|
|
320
|
+
"""Download survey data as an Excel file in one call.
|
|
321
|
+
|
|
322
|
+
If ``export_uid`` is provided, waits for that existing export task and
|
|
323
|
+
downloads it. Otherwise, ensures a reusable export setting named
|
|
324
|
+
``"python-client"`` exists (creating it if needed), triggers a new
|
|
325
|
+
export with the default configuration (``type="xls"``, ``lang="_xml"``),
|
|
326
|
+
and downloads the result.
|
|
327
|
+
|
|
328
|
+
Parameters
|
|
329
|
+
----------
|
|
330
|
+
asset_uid: UID of the survey asset.
|
|
331
|
+
export_uid: Optional UID of an already-triggered export task.
|
|
332
|
+
If omitted, a new export is triggered automatically.
|
|
333
|
+
path: Destination file path. Defaults to ``data_survey.xlsx``
|
|
334
|
+
in the current working directory.
|
|
335
|
+
poll_interval: Seconds between status checks while waiting.
|
|
336
|
+
timeout: Maximum seconds to wait for the export to finish.
|
|
337
|
+
|
|
338
|
+
Returns the resolved :class:`~pathlib.Path` of the saved file.
|
|
339
|
+
|
|
340
|
+
Example
|
|
341
|
+
-------
|
|
342
|
+
>>> saved = client.get_excel("atXzmELZmQgQkWD4cAnumv")
|
|
343
|
+
>>> print(saved)
|
|
344
|
+
/home/user/project/data_survey.xlsx
|
|
345
|
+
"""
|
|
346
|
+
if export_uid is None:
|
|
347
|
+
self.get_or_create_export_setting(asset_uid, name="python-client")
|
|
348
|
+
export_uid = self.trigger_export(asset_uid)
|
|
349
|
+
|
|
350
|
+
return self.download_export(asset_uid, export_uid, path, poll_interval, timeout)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kobo-api-v2"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A synchronous Python client for the KoboToolbox API v2"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Diego Mora", email = "morabdiego@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["kobotoolbox", "kobo", "api", "survey", "data-collection", "xlsform"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
27
|
+
"Topic :: Scientific/Engineering",
|
|
28
|
+
"Typing :: Typed",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"requests>=2.32",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://github.com/morabdiego/kobo-api-v2"
|
|
36
|
+
Repository = "https://github.com/morabdiego/kobo-api-v2"
|
|
37
|
+
"Bug Tracker" = "https://github.com/morabdiego/kobo-api-v2/issues"
|
|
38
|
+
|
|
39
|
+
[tool.hatch.build.targets.wheel]
|
|
40
|
+
packages = ["kobo"]
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
version = 1
|
|
2
|
+
revision = 3
|
|
3
|
+
requires-python = ">=3.14"
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "certifi"
|
|
7
|
+
version = "2026.4.22"
|
|
8
|
+
source = { registry = "https://pypi.org/simple" }
|
|
9
|
+
sdist = { url = "https://files.pythonhosted.org/packages/25/ee/6caf7a40c36a1220410afe15a1cc64993a1f864871f698c0f93acb72842a/certifi-2026.4.22.tar.gz", hash = "sha256:8d455352a37b71bf76a79caa83a3d6c25afee4a385d632127b6afb3963f1c580", size = 137077, upload-time = "2026-04-22T11:26:11.191Z" }
|
|
10
|
+
wheels = [
|
|
11
|
+
{ url = "https://files.pythonhosted.org/packages/22/30/7cd8fdcdfbc5b869528b079bfb76dcdf6056b1a2097a662e5e8c04f42965/certifi-2026.4.22-py3-none-any.whl", hash = "sha256:3cb2210c8f88ba2318d29b0388d1023c8492ff72ecdde4ebdaddbb13a31b1c4a", size = 135707, upload-time = "2026-04-22T11:26:09.372Z" },
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[[package]]
|
|
15
|
+
name = "charset-normalizer"
|
|
16
|
+
version = "3.4.7"
|
|
17
|
+
source = { registry = "https://pypi.org/simple" }
|
|
18
|
+
sdist = { url = "https://files.pythonhosted.org/packages/e7/a1/67fe25fac3c7642725500a3f6cfe5821ad557c3abb11c9d20d12c7008d3e/charset_normalizer-3.4.7.tar.gz", hash = "sha256:ae89db9e5f98a11a4bf50407d4363e7b09b31e55bc117b4f7d80aab97ba009e5", size = 144271, upload-time = "2026-04-02T09:28:39.342Z" }
|
|
19
|
+
wheels = [
|
|
20
|
+
{ url = "https://files.pythonhosted.org/packages/97/c8/c67cb8c70e19ef1960b97b22ed2a1567711de46c4ddf19799923adc836c2/charset_normalizer-3.4.7-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:c36c333c39be2dbca264d7803333c896ab8fa7d4d6f0ab7edb7dfd7aea6e98c0", size = 309234, upload-time = "2026-04-02T09:27:07.194Z" },
|
|
21
|
+
{ url = "https://files.pythonhosted.org/packages/99/85/c091fdee33f20de70d6c8b522743b6f831a2f1cd3ff86de4c6a827c48a76/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1c2aed2e5e41f24ea8ef1590b8e848a79b56f3a5564a65ceec43c9d692dc7d8a", size = 208042, upload-time = "2026-04-02T09:27:08.749Z" },
|
|
22
|
+
{ url = "https://files.pythonhosted.org/packages/87/1c/ab2ce611b984d2fd5d86a5a8a19c1ae26acac6bad967da4967562c75114d/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:54523e136b8948060c0fa0bc7b1b50c32c186f2fceee897a495406bb6e311d2b", size = 228706, upload-time = "2026-04-02T09:27:09.951Z" },
|
|
23
|
+
{ url = "https://files.pythonhosted.org/packages/a8/29/2b1d2cb00bf085f59d29eb773ce58ec2d325430f8c216804a0a5cd83cbca/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:715479b9a2802ecac752a3b0efa2b0b60285cf962ee38414211abdfccc233b41", size = 224727, upload-time = "2026-04-02T09:27:11.175Z" },
|
|
24
|
+
{ url = "https://files.pythonhosted.org/packages/47/5c/032c2d5a07fe4d4855fea851209cca2b6f03ebeb6d4e3afdb3358386a684/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bd6c2a1c7573c64738d716488d2cdd3c00e340e4835707d8fdb8dc1a66ef164e", size = 215882, upload-time = "2026-04-02T09:27:12.446Z" },
|
|
25
|
+
{ url = "https://files.pythonhosted.org/packages/2c/c2/356065d5a8b78ed04499cae5f339f091946a6a74f91e03476c33f0ab7100/charset_normalizer-3.4.7-cp314-cp314-manylinux_2_31_armv7l.whl", hash = "sha256:c45e9440fb78f8ddabcf714b68f936737a121355bf59f3907f4e17721b9d1aae", size = 200860, upload-time = "2026-04-02T09:27:13.721Z" },
|
|
26
|
+
{ url = "https://files.pythonhosted.org/packages/0c/cd/a32a84217ced5039f53b29f460962abb2d4420def55afabe45b1c3c7483d/charset_normalizer-3.4.7-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:3534e7dcbdcf757da6b85a0bbf5b6868786d5982dd959b065e65481644817a18", size = 211564, upload-time = "2026-04-02T09:27:15.272Z" },
|
|
27
|
+
{ url = "https://files.pythonhosted.org/packages/44/86/58e6f13ce26cc3b8f4a36b94a0f22ae2f00a72534520f4ae6857c4b81f89/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:e8ac484bf18ce6975760921bb6148041faa8fef0547200386ea0b52b5d27bf7b", size = 211276, upload-time = "2026-04-02T09:27:16.834Z" },
|
|
28
|
+
{ url = "https://files.pythonhosted.org/packages/8f/fe/d17c32dc72e17e155e06883efa84514ca375f8a528ba2546bee73fc4df81/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:a5fe03b42827c13cdccd08e6c0247b6a6d4b5e3cdc53fd1749f5896adcdc2356", size = 201238, upload-time = "2026-04-02T09:27:18.229Z" },
|
|
29
|
+
{ url = "https://files.pythonhosted.org/packages/6a/29/f33daa50b06525a237451cdb6c69da366c381a3dadcd833fa5676bc468b3/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:2d6eb928e13016cea4f1f21d1e10c1cebd5a421bc57ddf5b1142ae3f86824fab", size = 230189, upload-time = "2026-04-02T09:27:19.445Z" },
|
|
30
|
+
{ url = "https://files.pythonhosted.org/packages/b6/6e/52c84015394a6a0bdcd435210a7e944c5f94ea1055f5cc5d56c5fe368e7b/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:e74327fb75de8986940def6e8dee4f127cc9752bee7355bb323cc5b2659b6d46", size = 211352, upload-time = "2026-04-02T09:27:20.79Z" },
|
|
31
|
+
{ url = "https://files.pythonhosted.org/packages/8c/d7/4353be581b373033fb9198bf1da3cf8f09c1082561e8e922aa7b39bf9fe8/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:d6038d37043bced98a66e68d3aa2b6a35505dc01328cd65217cefe82f25def44", size = 227024, upload-time = "2026-04-02T09:27:22.063Z" },
|
|
32
|
+
{ url = "https://files.pythonhosted.org/packages/30/45/99d18aa925bd1740098ccd3060e238e21115fffbfdcb8f3ece837d0ace6c/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:7579e913a5339fb8fa133f6bbcfd8e6749696206cf05acdbdca71a1b436d8e72", size = 217869, upload-time = "2026-04-02T09:27:23.486Z" },
|
|
33
|
+
{ url = "https://files.pythonhosted.org/packages/5c/05/5ee478aa53f4bb7996482153d4bfe1b89e0f087f0ab6b294fcf92d595873/charset_normalizer-3.4.7-cp314-cp314-win32.whl", hash = "sha256:5b77459df20e08151cd6f8b9ef8ef1f961ef73d85c21a555c7eed5b79410ec10", size = 148541, upload-time = "2026-04-02T09:27:25.146Z" },
|
|
34
|
+
{ url = "https://files.pythonhosted.org/packages/48/77/72dcb0921b2ce86420b2d79d454c7022bf5be40202a2a07906b9f2a35c97/charset_normalizer-3.4.7-cp314-cp314-win_amd64.whl", hash = "sha256:92a0a01ead5e668468e952e4238cccd7c537364eb7d851ab144ab6627dbbe12f", size = 159634, upload-time = "2026-04-02T09:27:26.642Z" },
|
|
35
|
+
{ url = "https://files.pythonhosted.org/packages/c6/a3/c2369911cd72f02386e4e340770f6e158c7980267da16af8f668217abaa0/charset_normalizer-3.4.7-cp314-cp314-win_arm64.whl", hash = "sha256:67f6279d125ca0046a7fd386d01b311c6363844deac3e5b069b514ba3e63c246", size = 148384, upload-time = "2026-04-02T09:27:28.271Z" },
|
|
36
|
+
{ url = "https://files.pythonhosted.org/packages/94/09/7e8a7f73d24dba1f0035fbbf014d2c36828fc1bf9c88f84093e57d315935/charset_normalizer-3.4.7-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:effc3f449787117233702311a1b7d8f59cba9ced946ba727bdc329ec69028e24", size = 330133, upload-time = "2026-04-02T09:27:29.474Z" },
|
|
37
|
+
{ url = "https://files.pythonhosted.org/packages/8d/da/96975ddb11f8e977f706f45cddd8540fd8242f71ecdb5d18a80723dcf62c/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fbccdc05410c9ee21bbf16a35f4c1d16123dcdeb8a1d38f33654fa21d0234f79", size = 216257, upload-time = "2026-04-02T09:27:30.793Z" },
|
|
38
|
+
{ url = "https://files.pythonhosted.org/packages/e5/e8/1d63bf8ef2d388e95c64b2098f45f84758f6d102a087552da1485912637b/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:733784b6d6def852c814bce5f318d25da2ee65dd4839a0718641c696e09a2960", size = 234851, upload-time = "2026-04-02T09:27:32.44Z" },
|
|
39
|
+
{ url = "https://files.pythonhosted.org/packages/9b/40/e5ff04233e70da2681fa43969ad6f66ca5611d7e669be0246c4c7aaf6dc8/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a89c23ef8d2c6b27fd200a42aa4ac72786e7c60d40efdc76e6011260b6e949c4", size = 233393, upload-time = "2026-04-02T09:27:34.03Z" },
|
|
40
|
+
{ url = "https://files.pythonhosted.org/packages/be/c1/06c6c49d5a5450f76899992f1ee40b41d076aee9279b49cf9974d2f313d5/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6c114670c45346afedc0d947faf3c7f701051d2518b943679c8ff88befe14f8e", size = 223251, upload-time = "2026-04-02T09:27:35.369Z" },
|
|
41
|
+
{ url = "https://files.pythonhosted.org/packages/2b/9f/f2ff16fb050946169e3e1f82134d107e5d4ae72647ec8a1b1446c148480f/charset_normalizer-3.4.7-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:a180c5e59792af262bf263b21a3c49353f25945d8d9f70628e73de370d55e1e1", size = 206609, upload-time = "2026-04-02T09:27:36.661Z" },
|
|
42
|
+
{ url = "https://files.pythonhosted.org/packages/69/d5/a527c0cd8d64d2eab7459784fb4169a0ac76e5a6fc5237337982fd61347e/charset_normalizer-3.4.7-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:3c9a494bc5ec77d43cea229c4f6db1e4d8fe7e1bbffa8b6f0f0032430ff8ab44", size = 220014, upload-time = "2026-04-02T09:27:38.019Z" },
|
|
43
|
+
{ url = "https://files.pythonhosted.org/packages/7e/80/8a7b8104a3e203074dc9aa2c613d4b726c0e136bad1cc734594b02867972/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:8d828b6667a32a728a1ad1d93957cdf37489c57b97ae6c4de2860fa749b8fc1e", size = 218979, upload-time = "2026-04-02T09:27:39.37Z" },
|
|
44
|
+
{ url = "https://files.pythonhosted.org/packages/02/9a/b759b503d507f375b2b5c153e4d2ee0a75aa215b7f2489cf314f4541f2c0/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:cf1493cd8607bec4d8a7b9b004e699fcf8f9103a9284cc94962cb73d20f9d4a3", size = 209238, upload-time = "2026-04-02T09:27:40.722Z" },
|
|
45
|
+
{ url = "https://files.pythonhosted.org/packages/c2/4e/0f3f5d47b86bdb79256e7290b26ac847a2832d9a4033f7eb2cd4bcf4bb5b/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:0c96c3b819b5c3e9e165495db84d41914d6894d55181d2d108cc1a69bfc9cce0", size = 236110, upload-time = "2026-04-02T09:27:42.33Z" },
|
|
46
|
+
{ url = "https://files.pythonhosted.org/packages/96/23/bce28734eb3ed2c91dcf93abeb8a5cf393a7b2749725030bb630e554fdd8/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:752a45dc4a6934060b3b0dab47e04edc3326575f82be64bc4fc293914566503e", size = 219824, upload-time = "2026-04-02T09:27:43.924Z" },
|
|
47
|
+
{ url = "https://files.pythonhosted.org/packages/2c/6f/6e897c6984cc4d41af319b077f2f600fc8214eb2fe2d6bcb79141b882400/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:8778f0c7a52e56f75d12dae53ae320fae900a8b9b4164b981b9c5ce059cd1fcb", size = 233103, upload-time = "2026-04-02T09:27:45.348Z" },
|
|
48
|
+
{ url = "https://files.pythonhosted.org/packages/76/22/ef7bd0fe480a0ae9b656189ec00744b60933f68b4f42a7bb06589f6f576a/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ce3412fbe1e31eb81ea42f4169ed94861c56e643189e1e75f0041f3fe7020abe", size = 225194, upload-time = "2026-04-02T09:27:46.706Z" },
|
|
49
|
+
{ url = "https://files.pythonhosted.org/packages/c5/a7/0e0ab3e0b5bc1219bd80a6a0d4d72ca74d9250cb2382b7c699c147e06017/charset_normalizer-3.4.7-cp314-cp314t-win32.whl", hash = "sha256:c03a41a8784091e67a39648f70c5f97b5b6a37f216896d44d2cdcb82615339a0", size = 159827, upload-time = "2026-04-02T09:27:48.053Z" },
|
|
50
|
+
{ url = "https://files.pythonhosted.org/packages/7a/1d/29d32e0fb40864b1f878c7f5a0b343ae676c6e2b271a2d55cc3a152391da/charset_normalizer-3.4.7-cp314-cp314t-win_amd64.whl", hash = "sha256:03853ed82eeebbce3c2abfdbc98c96dc205f32a79627688ac9a27370ea61a49c", size = 174168, upload-time = "2026-04-02T09:27:49.795Z" },
|
|
51
|
+
{ url = "https://files.pythonhosted.org/packages/de/32/d92444ad05c7a6e41fb2036749777c163baf7a0301a040cb672d6b2b1ae9/charset_normalizer-3.4.7-cp314-cp314t-win_arm64.whl", hash = "sha256:c35abb8bfff0185efac5878da64c45dafd2b37fb0383add1be155a763c1f083d", size = 153018, upload-time = "2026-04-02T09:27:51.116Z" },
|
|
52
|
+
{ url = "https://files.pythonhosted.org/packages/db/8f/61959034484a4a7c527811f4721e75d02d653a35afb0b6054474d8185d4c/charset_normalizer-3.4.7-py3-none-any.whl", hash = "sha256:3dce51d0f5e7951f8bb4900c257dad282f49190fdbebecd4ba99bcc41fef404d", size = 61958, upload-time = "2026-04-02T09:28:37.794Z" },
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[[package]]
|
|
56
|
+
name = "idna"
|
|
57
|
+
version = "3.13"
|
|
58
|
+
source = { registry = "https://pypi.org/simple" }
|
|
59
|
+
sdist = { url = "https://files.pythonhosted.org/packages/ce/cc/762dfb036166873f0059f3b7de4565e1b5bc3d6f28a414c13da27e442f99/idna-3.13.tar.gz", hash = "sha256:585ea8fe5d69b9181ec1afba340451fba6ba764af97026f92a91d4eef164a242", size = 194210, upload-time = "2026-04-22T16:42:42.314Z" }
|
|
60
|
+
wheels = [
|
|
61
|
+
{ url = "https://files.pythonhosted.org/packages/5d/13/ad7d7ca3808a898b4612b6fe93cde56b53f3034dcde235acb1f0e1df24c6/idna-3.13-py3-none-any.whl", hash = "sha256:892ea0cde124a99ce773decba204c5552b69c3c67ffd5f232eb7696135bc8bb3", size = 68629, upload-time = "2026-04-22T16:42:40.909Z" },
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[[package]]
|
|
65
|
+
name = "py-kobotoolbox"
|
|
66
|
+
version = "0.1.0"
|
|
67
|
+
source = { virtual = "." }
|
|
68
|
+
dependencies = [
|
|
69
|
+
{ name = "python-dotenv" },
|
|
70
|
+
{ name = "requests" },
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[package.metadata]
|
|
74
|
+
requires-dist = [
|
|
75
|
+
{ name = "python-dotenv", specifier = ">=1.0" },
|
|
76
|
+
{ name = "requests", specifier = ">=2.32" },
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[[package]]
|
|
80
|
+
name = "python-dotenv"
|
|
81
|
+
version = "1.2.2"
|
|
82
|
+
source = { registry = "https://pypi.org/simple" }
|
|
83
|
+
sdist = { url = "https://files.pythonhosted.org/packages/82/ed/0301aeeac3e5353ef3d94b6ec08bbcabd04a72018415dcb29e588514bba8/python_dotenv-1.2.2.tar.gz", hash = "sha256:2c371a91fbd7ba082c2c1dc1f8bf89ca22564a087c2c287cd9b662adde799cf3", size = 50135, upload-time = "2026-03-01T16:00:26.196Z" }
|
|
84
|
+
wheels = [
|
|
85
|
+
{ url = "https://files.pythonhosted.org/packages/0b/d7/1959b9648791274998a9c3526f6d0ec8fd2233e4d4acce81bbae76b44b2a/python_dotenv-1.2.2-py3-none-any.whl", hash = "sha256:1d8214789a24de455a8b8bd8ae6fe3c6b69a5e3d64aa8a8e5d68e694bbcb285a", size = 22101, upload-time = "2026-03-01T16:00:25.09Z" },
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
[[package]]
|
|
89
|
+
name = "requests"
|
|
90
|
+
version = "2.33.1"
|
|
91
|
+
source = { registry = "https://pypi.org/simple" }
|
|
92
|
+
dependencies = [
|
|
93
|
+
{ name = "certifi" },
|
|
94
|
+
{ name = "charset-normalizer" },
|
|
95
|
+
{ name = "idna" },
|
|
96
|
+
{ name = "urllib3" },
|
|
97
|
+
]
|
|
98
|
+
sdist = { url = "https://files.pythonhosted.org/packages/5f/a4/98b9c7c6428a668bf7e42ebb7c79d576a1c3c1e3ae2d47e674b468388871/requests-2.33.1.tar.gz", hash = "sha256:18817f8c57c6263968bc123d237e3b8b08ac046f5456bd1e307ee8f4250d3517", size = 134120, upload-time = "2026-03-30T16:09:15.531Z" }
|
|
99
|
+
wheels = [
|
|
100
|
+
{ url = "https://files.pythonhosted.org/packages/d7/8e/7540e8a2036f79a125c1d2ebadf69ed7901608859186c856fa0388ef4197/requests-2.33.1-py3-none-any.whl", hash = "sha256:4e6d1ef462f3626a1f0a0a9c42dd93c63bad33f9f1c1937509b8c5c8718ab56a", size = 64947, upload-time = "2026-03-30T16:09:13.83Z" },
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
[[package]]
|
|
104
|
+
name = "urllib3"
|
|
105
|
+
version = "2.6.3"
|
|
106
|
+
source = { registry = "https://pypi.org/simple" }
|
|
107
|
+
sdist = { url = "https://files.pythonhosted.org/packages/c7/24/5f1b3bdffd70275f6661c76461e25f024d5a38a46f04aaca912426a2b1d3/urllib3-2.6.3.tar.gz", hash = "sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed", size = 435556, upload-time = "2026-01-07T16:24:43.925Z" }
|
|
108
|
+
wheels = [
|
|
109
|
+
{ url = "https://files.pythonhosted.org/packages/39/08/aaaad47bc4e9dc8c725e68f9d04865dbcb2052843ff09c97b08904852d84/urllib3-2.6.3-py3-none-any.whl", hash = "sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4", size = 131584, upload-time = "2026-01-07T16:24:42.685Z" },
|
|
110
|
+
]
|