Python client library for the DataPress API
Project description
DataPress Python Client
A Python client library for interacting with the DataPress API.
Installation
pip install datapress-client
How to Use
Set your API credentials as environment variables:
export DATAPRESS_API_KEY="your-api-key"
export DATAPRESS_URL="https://your-datapress-instance.com"
Basic Usage
from datapress import DataPressClient
# Initialize client
client = DataPressClient()
# Verify authentication
user_info = client.whoami()
print(f"Logged in as: {user_info['title']}")
# Get a dataset
dataset = client.get_dataset("ab12x")
print(f"Dataset: {dataset['title']}")
Renaming a Dataset
# Rename a dataset using patch operations
patch = [{"op": "replace", "path": "/title", "value": "New Dataset Name"}]
result = client.patch_dataset("ab12x", patch)
print(f"Dataset renamed to: {result['dataset']['title']}")
Adding a File
# Upload a new file to a dataset
result = client.upload_file(
dataset_id="ab12x",
file_path="data/sales.csv",
title="Sales Data",
description="Monthly sales figures"
)
print(f"File uploaded with ID: {result['resource_id']}")
Replacing a File
# Replace an existing file
result = client.upload_file(
dataset_id="ab12x",
file_path="data/updated_spending.csv",
resource_id="xyz", # ID of existing file to replace
title="Updated Spending Data"
)
print(f"File replaced: {result['resource_id']}")
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
datapress-1.0.0.tar.gz
(9.5 kB
view details)
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
datapress-1.0.0-py3-none-any.whl
(10.7 kB
view details)
File details
Details for the file datapress-1.0.0.tar.gz.
File metadata
- Download URL: datapress-1.0.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86b98fcfd30ab8978b44fa32cae2b7faae230b0c6c34f6b5f21dfc68162aa68c
|
|
| MD5 |
27ba018c5ea141ead911570e7717b181
|
|
| BLAKE2b-256 |
dd399046db30a97d6d8a0d817365255ea2a7d10b2a7fec47de8b737edb198025
|
File details
Details for the file datapress-1.0.0-py3-none-any.whl.
File metadata
- Download URL: datapress-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8175f0cb8b28fb19d80c339a3a6106590aaf9534f4f3af689c91abca16ed874b
|
|
| MD5 |
8f95c2975f6d9e97ea144076bdf5c63b
|
|
| BLAKE2b-256 |
613c68511169b639c8e1950646ade1a6a58c835161f0ba05b8531abdc145bcef
|