Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ The command-line interface provides commands for downloading, deploying, and del
<a id="cli-download"></a>
### Download

The `download` command retrieves Databus files, versions, artifacts, groups, collections, or SPARQL query results. It supports authentication, checksum validation, compression conversion, and RDF or tabular format conversion. See the [download docs](doc/cli-usage.md#cli-download).
The `download` command retrieves Databus files, versions, artifacts, groups, collections, or SPARQL query results. It supports authentication, checksum validation, compression conversion, RDF or tabular format conversion, and resuming interrupted downloads with `-c` / `--resume`. See the [download docs](doc/cli-usage.md#cli-download).

<a id="cli-deploy"></a>
### Deploy
Expand Down
341 changes: 258 additions & 83 deletions databusclient/api/download.py

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions databusclient/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,13 @@ def _write_manifest():
"--user-agent",
help="Override the HTTP User-Agent header for file download requests.",
)
@click.option(
"--resume",
"-c",
is_flag=True,
default=False,
help="Resume partially downloaded files using HTTP Range requests.",
)
def download(
databusuris: List[str],
localdir,
Expand All @@ -345,6 +352,7 @@ def download(
validate_checksum,
manifest_path,
user_agent,
resume,
):
"""
Download datasets from databus, optionally using vault access if vault options are provided.
Expand Down Expand Up @@ -377,6 +385,7 @@ def download(
"user_agent": user_agent,
"authurl": authurl,
"clientid": clientid,
"resume": resume,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
})
try:
api_download(
Expand All @@ -396,6 +405,7 @@ def download(
validate_checksum=validate_checksum,
user_agent=user_agent,
manifest_context=manifest_context,
resume=resume,
)
except DownloadAuthError as e:
if manifest_context:
Expand Down
1 change: 1 addition & 0 deletions databusclient/manifest/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def _build_download_kwargs(
"graph_mode": replay_params.get("graph_mode"),
"user_agent": replay_params.get("user_agent"),
"validate_checksum": bool(replay_params.get("validate_checksum", False)),
"resume": bool(replay_params.get("resume", False)),
"manifest_context": None,
}

Expand Down
1 change: 1 addition & 0 deletions databusclient/workflow/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def run(self, step_config: Dict[str, Any], context: StepContext) -> None:
base_uri=resolved.get("base_uri"),
graph_mode=resolved.get("graph_mode"),
user_agent=resolved.get("user_agent"),
resume=resolved.get("resume", False),
validate_checksum=resolved.get("validate_checksum", False),
manifest_context=capture_context,
)
Expand Down
7 changes: 7 additions & 0 deletions doc/cli-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ databusclient download $DOWNLOADTARGET
- Validates the checksums of downloaded files against the checksums provided by the Databus. If a checksum does not match, an error is raised and the file is deleted.
- `--user-agent`
- Overrides the HTTP User-Agent header for file download requests. Default: `databus-python-client/<version> (https://github.com/dbpedia/databus-python-client)`. Example: `--user-agent "DatabusDownloadBot/1.0 (mailto:you@example.org)"`.
- `-c, --resume`
- Resumes interrupted downloads if partial files already exist on disk using HTTP `Range` request headers. If the remote host supports byte ranges (returns `206 Partial Content`), only the missing bytes are downloaded and appended to the existing file. If the remote host does not support range requests (returns `200 OK`), the download safely restarts from scratch. If the local file is already fully downloaded, the download is skipped.

**Help and further information on download command:**
```bash
Expand All @@ -55,6 +57,11 @@ databusclient download --help
databusclient download https://databus.dbpedia.org/dbpedia/mappings/mappingbased-literals/2022.12.01/mappingbased-literals_lang=az.ttl.bz2
```

**Resume Interrupted Download**: continue an interrupted file download without re-downloading existing bytes
```bash
databusclient download https://databus.dbpedia.org/dbpedia/mappings/mappingbased-literals/2022.12.01/mappingbased-literals_lang=az.ttl.bz2 --resume
```

**Download Version**: download of all files of a specific version
```bash
databusclient download https://databus.dbpedia.org/dbpedia/mappings/mappingbased-literals/2022.12.01
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "databusclient"
version = "1.3.2"
version = "1.4.0"
description = "A simple client for submitting, downloading, and deleting data on the DBpedia Databus"
authors = ["DBpedia Association"]
license = "Apache-2.0 License"
Expand Down
Loading