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

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.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

datapress-1.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file datapress-1.1.0.tar.gz.

File metadata

  • Download URL: datapress-1.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for datapress-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e1c0bec3d350058302e3faf2f93e8d74194e8a2b3d95b7068570c3b7d653f240
MD5 ef977bf921835ca91b8a3e12dc7c7f0b
BLAKE2b-256 38d53357d4d19a9732ca257ea0855bc73d97d89487cad7b0dfe47ee5a123038a

See more details on using hashes here.

File details

Details for the file datapress-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: datapress-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for datapress-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6d4f0aca96f320246dde882d38de6c17eddf301229a4dfab49c78509fbd5892
MD5 f9b270709021d8451bfc214acc7ecb13
BLAKE2b-256 703cbc35beb546992c6e6cc3cc4ae420005843b0e71006d17d3e3ceb3e6807da

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