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",
    # Optional parameters:
    title="Sales Data",
    description="Monthly sales figures",
    order=1,
    timeframe={"from": "2024-01", "to": "2025-04"}
)
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",
    # Optional parameters:
    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.1.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.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: datapress-1.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 026531bfbb4872492d5fbbca356a668af3b475d96c333c4fdaf690c4a0e1ef00
MD5 d20637f43a5a01621041fedd8a1fa6d7
BLAKE2b-256 f39b966a3dd662e9b3e9d19c03c8f4067ea7ac02de78f850d2b7fff4b8f43578

See more details on using hashes here.

File details

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

File metadata

  • Download URL: datapress-1.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c61472a2f1f4c6f014003a87020f76d85ec93a6d81308e35505a0a3087c18ee
MD5 2f2ce1170a9bdef51e6555c20a40c064
BLAKE2b-256 71bbe49315ea17b4a92837303aad5dae21adf0d9cb5406ec172593f957497c0e

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