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.4.tar.gz (6.8 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.4-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysolidarity-0.2.4.tar.gz
  • Upload date:
  • Size: 6.8 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.4.tar.gz
Algorithm Hash digest
SHA256 d1fa759dc812c644f8f8134d89633a1341829ded753028caa018d0ffad625a4d
MD5 f6c09c2857082fbd39c575b126fb2799
BLAKE2b-256 01d285b5e18b4edc6249aad507541651aba182261259b95c4db318d20e91d2d9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysolidarity-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 9.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b2d497f7d29910c715ceb73b52a9c53c4bb1528c9e68f8400f9e927954e189ea
MD5 a253712c1d2af09019f62d32b73af777
BLAKE2b-256 c2926d073e336f7298585e1e60d646d1cfa87e8d7dd929b3bc8a99e789b82ae9

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