Skip to main content

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"])

# Set exclusive chapter
client.users.update(user["id"], {"chapter_id": 123, "set_exclusive_chapter": True})

# 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)

# Add a user action
client.users.add_action(
    page_id=1234,
    user_id=user["id"],
    data={
        "email": "taylor.smith@example.com",
        "phone_number": "16135551234",
        "first_name": "Taylor",
        "last_name": "Smith",
        "address": {
            "address1": "123 Maple St",
            "address2": "Unit 4",
            "city": "Toronto",
            "state": "ON",
            "zip_code": "M5V1J2",
            "country": "CA",
        },
        "sms_permission": True,
        "call_permission": True,
        "email_permission": True,
    },
)

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]

Pushing a new version

Ensure you update the version in _version.py and pyproject.toml

python -m pip install --upgrade build
python -m build
python -m pip install --upgrade twine
python -m twine upload dist/*

Release files for pysolidarity 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysolidarity 0.5.1
File Size Uploaded
pysolidarity-0.5.1.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pysolidarity 0.5.1
File Interpreter ABI Platform
pysolidarity-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / pysolidarity-0.5.1.tar.gz

Download URL pysolidarity-0.5.1.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c9fbb5f441f933287f0c5ee7489c4569329dc23c77a82c52df666972136cabd0
BLAKE2b-256 checksum
How to use checksums
1d5e953c4aa0d45081b7ce262db93be8dfea4461a4dc91c61aa56630cf01f414
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pysolidarity-0.5.1-py3-none-any.whl

Download URL pysolidarity-0.5.1-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
728468d3fb1acb86caca6b00e31820f21c36f0fb0faacd8680e3621a7783fd3c
BLAKE2b-256 checksum
How to use checksums
3a45b6174496623bb685cc7ad3ddf11f4298a1ef4c65d64ca81fecd3baa4c8df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page