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
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.1.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.1-py3-none-any.whl
(10.7 kB
view details)
File details
Details for the file datapress-1.0.1.tar.gz.
File metadata
- Download URL: datapress-1.0.1.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 |
40e19bfb18f147fba8d00625d0e59496daad080efaef593397f0707c6b238ec5
|
|
| MD5 |
2a3ee234871c9824803141d38ef91c9d
|
|
| BLAKE2b-256 |
f86b0e37027f1dcd8655a68d3d31464a59bb1092b4608524937c0c273017359f
|
File details
Details for the file datapress-1.0.1-py3-none-any.whl.
File metadata
- Download URL: datapress-1.0.1-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 |
d4c04e688b3ca0eb498176e46150d7f340482a51b0aad2f40ee550ec18182213
|
|
| MD5 |
ad8873594921a2ed38aef33959a8c95d
|
|
| BLAKE2b-256 |
f712355c6e9f7c2fd3b4ec2bf68750ebeb24f0a310595d323c1d5b47060c259c
|