Skip to main content

Python SDK for PinArkive API v3 – minimal client (upload, pin, remove, users/me, uploads, tokens, status, allocations). See https://pinarkive.com/docs.php

Reason this release was yanked:

Use v3.1.0

Project description

Pinarkive Python SDK

Minimal Python client for the PinArkive API v3. Upload files, pin by CID, manage tokens, and check status. See pinarkive.com/docs.php.

Version: 3.0.1

Installation

pip install pinarkive-sdk-py

Quick Start

from pinarkive_client import PinarkiveClient, PinarkiveError

# Auth: Bearer token or X-API-Key (default base URL: https://api.pinarkive.com/api/v3)
client = PinarkiveClient(api_key="your-api-key-here")

# Upload a file
result = client.upload_file("document.pdf")
print(result["cid"])

# Or login first
login = client.login("user@example.com", "password")
client = PinarkiveClient(token=login["token"])

# List uploads
data = client.list_uploads(page=1, limit=20)
print(data["uploads"])

Authentication

  • API Key: PinarkiveClient(api_key="...") — sent as X-API-Key header.
  • JWT: PinarkiveClient(token="...") — sent as Authorization: Bearer <token>.
  • Base URL: optional third argument, default https://api.pinarkive.com/api/v3.

API Methods (minimal set)

Method Description
health() GET /health
get_plans() GET /plans/
get_peers() GET /peers/
login(email, password) POST /auth/login
upload_file(path, cluster_id=None, timelock=None) POST /files/
upload_directory(dir_path, cluster_id=None, timelock=None) POST /files/directory
upload_directory_dag(files_dict, dir_name=None, cluster_id=None, timelock=None) POST /files/directory-dag
pin_cid(cid, original_name=None, custom_name=None, cluster_id=None, timelock=None) POST /files/pin/:cid
remove_file(cid) DELETE /files/remove/:cid
get_me() GET /users/me
list_uploads(page=1, limit=20) GET /users/me/uploads
generate_token(name, label=None, expires_in_days=None) POST /tokens/generate
list_tokens() GET /tokens/list
revoke_token(name) DELETE /tokens/revoke/:name
get_status(cid, cluster_id=None) GET /status/:cid
get_allocations(cid, cluster_id=None) GET /allocations/:cid

Optional cluster_id and timelock (ISO 8601, premium) follow the API docs.

Error handling

On HTTP 4xx/5xx the client raises PinarkiveError with:

  • status_code — HTTP status (400, 401, 403, 404, 409, 413, 429, 500, 503)
  • message — from API message or error
  • body — full JSON body
  • .error — API field error
  • .code — API field code (e.g. email_not_verified)
try:
    client.upload_file("large.bin")
except PinarkiveError as e:
    print(e.status_code, e.message, e.code)

Changelog

3.0.0

  • API v3: Base URL is now https://api.pinarkive.com/api/v3 (was /api/v2). v1/v2 are deprecated (410).
  • Errors: On 4xx/5xx the client raises PinarkiveError with status_code, message, body, and .error / .code from the API (no raw Response on failure).
  • Minimal surface: Only endpoints documented at pinarkive.com/docs.php: health, plans, peers, login, files (upload, directory, directory-dag, pin, remove), users/me, uploads, tokens (generate with name / label / expiresInDays), status, allocations. Optional cluster_id and timelock (ISO 8601) on upload/pin.
  • Removed: rename_file; token options permissions, ip_allowlist. Use API label and expiresInDays only.
  • Pin: pin_cid now accepts original_name, custom_name (replacing the old filename).
  • Return values: Successful calls return decoded JSON (dict); methods that return nothing on success (remove_file, revoke_token) return None.

Upgrading from 2.x

  1. Change base URL to /api/v3 or rely on the new default.
  2. Replace result.json() with the direct return value (client returns dicts; on error, PinarkiveError is raised).
  3. Catch PinarkiveError instead of requests.HTTPError and use e.status_code, e.message, e.body.
  4. Use pin_cid(cid, custom_name=...) instead of pin_cid(cid, filename=...); add original_name if needed.
  5. Use generate_token(name, label=..., expires_in_days=...); drop permissions and ip_allowlist.
  6. Pin to pinarkive-sdk-py>=3.0.0 if you rely on v3 behaviour.

Links

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

pinarkive_sdk_py-3.0.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

pinarkive_sdk_py-3.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file pinarkive_sdk_py-3.0.1.tar.gz.

File metadata

  • Download URL: pinarkive_sdk_py-3.0.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pinarkive_sdk_py-3.0.1.tar.gz
Algorithm Hash digest
SHA256 7dd364152f0ab2d9fdb2d2db5c8387c778976d26e24e9f4ebf030196cbcf3f24
MD5 bc210de9a62ef8b94a663266a90595e2
BLAKE2b-256 0fc7bda09cc09a599738d88b28f0061214c3355d283b332ad2c24fe0e028ba3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinarkive_sdk_py-3.0.1.tar.gz:

Publisher: publish.yml on pinarkive/pinarkive-sdk-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pinarkive_sdk_py-3.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pinarkive_sdk_py-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 71ff40c5159e1e0a6417c29cc8d2f472d69cec7f093097c9ff4efa5df805faea
MD5 37deefaee28e4a7ebe566b6a7d9b78d3
BLAKE2b-256 f51e20948efc58bf323c66c0c68b1c8e2a3923951a311f6f7b9078f0ece925a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinarkive_sdk_py-3.0.1-py3-none-any.whl:

Publisher: publish.yml on pinarkive/pinarkive-sdk-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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