Skip to main content

Client for interacting with Pinapple

Project description

🍍 PinappleClient 🍍

Python client for the Pinapple encryption API with automatic token management and robust error handling.

Installation

pip install PinappleClient

Quick Start

from pinapple_client import PinappleClient

client = PinappleClient(
    user="username",
    password="password",
    api_url="https://api.pinapple.com"
)

# Encrypt/decrypt individual PINs
encrypted = client.encrypt_pins(["123456", "789012"])
decrypted = client.decrypt_pins(["enc_abc123", "enc_def456"])

# Validate PINs
validation = client.validate_pins(["123456", "789012"])

DataFrame Operations

Pandas

import pandas as pd

df = pd.DataFrame({
    'id': [1, 2, 3],
    'pin': ['123456', '789012', '345678']
})

# Encrypt
encrypted_df = client.encrypt_pandas_dataframe(df, 'pin', batch_size=100)

# Decrypt
decrypted_df = client.decrypt_pandas_dataframe(encrypted_df, 'pin', batch_size=100)

Polars

import polars as pl

df = pl.DataFrame({
    'id': [1, 2, 3],
    'pin': ['123456', '789012', '345678']
})

# Encrypt
encrypted_df = client.encrypt_polars_dataframe(df, 'pin', batch_size=100)

# Decrypt
decrypted_df = client.decrypt_polars_dataframe(encrypted_df, 'pin', batch_size=100)

Configuration

client = PinappleClient(
    user="username",
    password="password",
    api_url="https://api.pinapple.com",
    refresh_token_after_x_minutes=5,  # Token refresh buffer (default: 5)
    timeout=30,                        # Request timeout (default: 30)
    max_retries=3,                     # Retry attempts (default: 3)
    backoff_base=2.0                   # Exponential backoff (default: 2.0)
)

Token Management

  • Automatic token refresh before expiration
  • Thread-safe token operations
  • JWT payload parsing for expiration tracking

Network Resilience

  • Exponential backoff retry: backoff_base ^ (attempt + 1)
  • Handles 503 database errors
  • Connection/timeout error recovery

License

GPL-3.0

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

pinappleclient-2.0.5.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

pinappleclient-2.0.5-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file pinappleclient-2.0.5.tar.gz.

File metadata

  • Download URL: pinappleclient-2.0.5.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pinappleclient-2.0.5.tar.gz
Algorithm Hash digest
SHA256 aca9606c6aac3eee84a2612d73e93879c40fa4e1a2118c158766a1843b695ee1
MD5 675d94e4b73dbdf9ba33d77afe365575
BLAKE2b-256 8e54e26939f9c6b6c6fbfc381fe61c914e5330dc5c5b68346f9fcdb0e55b9f16

See more details on using hashes here.

File details

Details for the file pinappleclient-2.0.5-py3-none-any.whl.

File metadata

  • Download URL: pinappleclient-2.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pinappleclient-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 51aeaf7261887f8e2019fad9b155951a00ea3401fc3e949886d241b350a81737
MD5 5e39d6744f807a1fe8fbe9184f87c8fa
BLAKE2b-256 59920400bc10c2f1067adad539b917134f8fba28290e2b42571b8f23c68e9383

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