Skip to main content

A tiny, modular Solidarity.Tech API wrapper with optional Redis-backed rate limiting.

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.

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

Rate limiting (optional)

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]
pytest -q
ruff check pysolidarity tests
mypy pysolidarity

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.1.0.tar.gz (5.4 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.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pysolidarity-0.1.0.tar.gz
Algorithm Hash digest
SHA256 23307ee7d7acab62a28a368c02c97fa2bdb32010247ca197e95e9c4c2d9c40e2
MD5 68119709d602bfc06a131d8b45e53dbc
BLAKE2b-256 751015903ba8e629eb424001807f9cc943e488fa35ba369e91bfb591e1408bfe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysolidarity-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61213691bedac57606ade1977eb11b92991360cb3a112d16df2227a2a8b0628a
MD5 7e01cf6c829ceb99a7bfee5923e4bdd9
BLAKE2b-256 f2653b7c366c2d9022a923811106ae81272029109126522c4b4c324beb6d26ef

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