Skip to main content

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_client-1.0.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datapress_client-1.0.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file datapress_client-1.0.0.tar.gz.

File metadata

  • Download URL: datapress_client-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

Hashes for datapress_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 903093803fe637d65edf6c08f3ec7689ac192520523f9ceadb295462ac044346
MD5 aa4d702a87f7c93f919fb7bd31f58622
BLAKE2b-256 38a0a07239a95d000ba47a9e96b0bde1354245f047eccd20dd90e2921c015a3f

See more details on using hashes here.

File details

Details for the file datapress_client-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for datapress_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43965c04f718035a414ba704e48dc7a9a6997f54d318f9cdf4b68e61bfadfab9
MD5 b4330332c9ccd126f0d625e9e6b4e05b
BLAKE2b-256 2f3127477ceb36177622f61d3e5e3fa5a7f47c80e38c80951fe61cafb50fb6ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page