Skip to main content

A Solidarity.Tech Python API Wrapper

Project description

pysolidarity

Solidarity.Tech API Wrapper for Python.

Creates a clean(er) python interface to a few functions of the Solidarity.tech API.

This is an early version. Not fully tested. Significantly vibe-coded. USE AT YOUR OWN RISK

Currently only supports creating, updating, and fetching users.

Installation

pip install pysolidarity
# with optional rate limiting support
pip install "pysolidarity[rate]"

Quick start

from pysolidarity import make_client_from_env

# export SOLIDARITY_API_KEY=...
client = make_client_from_env()

# Create-or-update by email or phone
user = client.users.create_or_update({"phone_number": "15555555555", "first_name":"Jimmy"})
print(user)

# Update (returns all user details)
client.users.update(user["id"], {"first_name":"Jiiiimmy"})

# Get (returns all user details)
client.users.get(user["id"])

# Enrol in automation (example below is by user_id but you can do it with email and phone_number)
client.users.enroll_in_automation(automation_id=12,user_id=1234)

Rate limiting (does not work in publicly available version)

import redis
from pysolidarity import make_rate_limited_client

r = redis.Redis(host="127.0.0.1", port=6379)
client = make_rate_limited_client(r, req_per_sec=4)
print(client.users.get(1234))

Environment

SOLIDARITY_API_KEY (required)

Development

pip install -e .[dev]

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

pysolidarity-0.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

pysolidarity-0.2.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file pysolidarity-0.2.0.tar.gz.

File metadata

  • Download URL: pysolidarity-0.2.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pysolidarity-0.2.0.tar.gz
Algorithm Hash digest
SHA256 74c96d9fece9b5e75da7d6a97d0fc98e242866879079d0b87938d6c609aa056e
MD5 2f9d9115909a462c3ba29d6ac2a94491
BLAKE2b-256 613001cb2c6020184edbe4f19cbc549029525c41ae2063198b665158543cf42b

See more details on using hashes here.

File details

Details for the file pysolidarity-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pysolidarity-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pysolidarity-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1cbf056154d12f8d00378544d0e5cf7f5b845895461d5bd303c380666930f99
MD5 a91a99cbb2dffd7d2e1018326765db37
BLAKE2b-256 17c157078fd96e76969d193dd99093894b83764cf250ecdeea9b039269c4be66

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