SSB Collector Client
Project description
SSB Collector Client
Features
- Start new data collector tasks with custom specifications
- List all running collector tasks
- Stop running collector tasks by ID
- Built-in authentication using Dapla Auth Client
- Object-oriented API with
CollectorClientclass
Requirements
- Python 3.10 or higher
- Access to a Data Collector service
- Dapla authentication credentials
Installation
You can install SSB Collector Client via pip from PyPI:
pip install ssb-collector-client
Usage
The SSB Collector Client provides an object-oriented interface using the CollectorClient class:
Quick Start
from ssb_collector_client import CollectorClient
# Initialize the client with your collector service URL
client = CollectorClient("https://your-collector-service.no/tasks")
# Define your collector specification
specification = {
"type": "your-collector-type",
# ... other specification parameters
}
# Start a new task
response = client.start(specification)
# Get all running tasks
tasks = client.running_tasks()
print(f"Running tasks: {tasks.json()}")
# Stop a specific task by ID
client.stop(task_id=1234)
Complete Example
Here's a complete example using the CollectorClient class:
from ssb_collector_client import CollectorClient
# Initialize the client
collector_url = "https://your-collector-service.no/tasks"
client = CollectorClient(collector_url)
# Define your collector specification
specification = {
"type": "example-type",
"name": "my-collection-task",
# ... other specification parameters
}
# Start a new task
print("Starting collector task...")
start_response = client.start(specification)
print(f"Task started: {start_response.status_code}")
# Check running tasks
print("\nChecking running tasks...")
tasks_response = client.running_tasks()
tasks = tasks_response.json()
print(f"Running tasks: {tasks}")
# Stop a specific task if needed
if tasks:
task_id = 1234 # Replace with actual task ID
print(f"\nStopping task {task_id}...")
client.stop(task_id)
Please see the Reference Guide for details.
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, SSB Collector Client is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
This project was generated from Statistics Norway's SSB PyPI Template.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ssb_collector_client-0.0.4.tar.gz.
File metadata
- Download URL: ssb_collector_client-0.0.4.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e112bbcbf9a59cc823116ae16af5b58d01d6785116a465c3d9eeddbb03bca74c
|
|
| MD5 |
71457e17b6997e74ccce1587fccb3edb
|
|
| BLAKE2b-256 |
4817b965178b36301c244f3bfd85891ca376a9d33185a4dd4463c1aca01942a0
|
Provenance
The following attestation bundles were made for ssb_collector_client-0.0.4.tar.gz:
Publisher:
release.yml on statisticsnorway/ssb-collector-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ssb_collector_client-0.0.4.tar.gz -
Subject digest:
e112bbcbf9a59cc823116ae16af5b58d01d6785116a465c3d9eeddbb03bca74c - Sigstore transparency entry: 724922334
- Sigstore integration time:
-
Permalink:
statisticsnorway/ssb-collector-client@a6022290915559dbe85582c2142364ed4e588194 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/statisticsnorway
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a6022290915559dbe85582c2142364ed4e588194 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ssb_collector_client-0.0.4-py3-none-any.whl.
File metadata
- Download URL: ssb_collector_client-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
155ae0058b29aeab3d490a8cb16c9f81d308704ac22c4158201fee3cbcf52461
|
|
| MD5 |
567928d51d09f61e7c2dbcf81902a27d
|
|
| BLAKE2b-256 |
725d42b45ab64fcab35c12768e9197cca514c3c5fbc1b18f59e98429e51e00c2
|
Provenance
The following attestation bundles were made for ssb_collector_client-0.0.4-py3-none-any.whl:
Publisher:
release.yml on statisticsnorway/ssb-collector-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ssb_collector_client-0.0.4-py3-none-any.whl -
Subject digest:
155ae0058b29aeab3d490a8cb16c9f81d308704ac22c4158201fee3cbcf52461 - Sigstore transparency entry: 724922338
- Sigstore integration time:
-
Permalink:
statisticsnorway/ssb-collector-client@a6022290915559dbe85582c2142364ed4e588194 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/statisticsnorway
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a6022290915559dbe85582c2142364ed4e588194 -
Trigger Event:
push
-
Statement type: