Add your description here
Project description
Solidarity Tech Tools
An unofficial python library to help you automate solidarity tech (ST).
See the ST api page for more details: https://www.solidarity.tech/reference/
This is still in beta, and there is a bit more work to do. But you can still use this in production if you are bold.
Features
Client
Call python methods to interact with the ST api. You can pass pydantic models and receive pydantic models in return, so you can rely on the response structure.
from solidaritytechtools import STClient, models
with STClient(api_key="...") as client:
# Perform calls
users = client.get_users()
# When passing arguments, you can either pass a Pydantic model (recommended)...
user_1 = client.create_user(models.UserCreate(
chapter_id=1,
phone_number='4145551234'
))
# ...or a raw dict
user_2 = client.create_user({
"chapter_id": 1,
"phone_number": "4145551234"
})
The client also handles rate limiting, honoring Retry-After headers, so you can be confident scripts won't break when rate limited.
JSON Export Tools
The library includes tools for validating and parsing Solidarity Tech JSON export files into structured models.
from solidaritytechtools import get_persons_from_json_export
# Load and validate an export file
people = get_persons_from_json_export("export-members-data.json")
for person in people:
print(f"{person.first_name} {person.last_name} has {len(person.notes)} notes")
Contact Matching
Given a JSON contact export and a live ST account, you can find the best matches to link local data to live API users. This is extremely useful for migrating historical data (like notes) from one ST account to another.
from solidaritytechtools import find_best_match
# Returns a mapping of {person_id: ClientUserMatch}
# Behind the scenes, this is using the `solidaritytechtools.client` and `solidaritytechtools.json_export`
matches = find_best_match(
json_export_file="old_account_export.json",
api_key="new_account_api_key"
)
for person_id, match in matches.items():
if match:
print(f"Export Person {person_id} -> API User {match.user_id} ({match.confidence*100}% confidence)")
Current heuristics use email and phone for high-confidence matching, and name + zip code for lower-confidence fuzzy matching. Please look through the code before using this in production to understand what it's doing.
Using
- Add
solidaritytechtoolsas a dependency viauv add solidaritytechtools,pip install solidaritytechtools, etc - Import the client, models, or functions, like
from solidaritytechtools import STClient, models, find_best_match
See the /examples directory for scripts demonstrating usage.
Using Pydantic models provides better type safety and IDE autocompletion, but you can always fall back to a dict if the API spec drifts or a model is missing a field.
If you notice client functions not working as expected, feel free to use raw internal methods like client._get("path") or client._put("path", json=payload) to do what you need, and then submit an issue or a MR.
Contributing
- Clone the repo
- Install pre-commit hooks (
uv run pre-commit install) - Start coding and make a MR :)
Please use uv run ty check . to check the type safety of your code before submitting a MR.
Publishing
The maintainer will probably take care of this
uv version --bump patch(or minor, major etc)uv syncgit add pyproject.toml uv.lockgit commit -m "Release $(uv version)" && git tag v$(uv version --short)git push origin main --tags
Github workflow will push to pypi.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file solidaritytechtools-0.2.0.tar.gz.
File metadata
- Download URL: solidaritytechtools-0.2.0.tar.gz
- Upload date:
- Size: 51.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e85dc09c5ab85d6f71f2f65eb68ab14c0041391cd18fb7c0f189520109deaa4
|
|
| MD5 |
fc890fbee8fb3072b2fe56c587bde801
|
|
| BLAKE2b-256 |
8c07d8c773edcc3d7ef8205f6f619b8ba7f7bfdd0206ead6e84f1c1c25cb535c
|
Provenance
The following attestation bundles were made for solidaritytechtools-0.2.0.tar.gz:
Publisher:
workflow.yml on jackklika/solidaritytechtools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
solidaritytechtools-0.2.0.tar.gz -
Subject digest:
5e85dc09c5ab85d6f71f2f65eb68ab14c0041391cd18fb7c0f189520109deaa4 - Sigstore transparency entry: 1915806871
- Sigstore integration time:
-
Permalink:
jackklika/solidaritytechtools@a4dfb3a024ad8fb488331d55768b03decd0ae0fd -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/jackklika
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a4dfb3a024ad8fb488331d55768b03decd0ae0fd -
Trigger Event:
push
-
Statement type:
File details
Details for the file solidaritytechtools-0.2.0-py3-none-any.whl.
File metadata
- Download URL: solidaritytechtools-0.2.0-py3-none-any.whl
- Upload date:
- Size: 33.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fb6eb2cb6981374166be1d73a494c14f12e564df0689ef308cf0195051cbed7
|
|
| MD5 |
b43493ce52e810e6c465dd86c424059c
|
|
| BLAKE2b-256 |
eb6037566dd4489e4455aadf7135805ff2e8a4860e75789e29b958e5a56647b8
|
Provenance
The following attestation bundles were made for solidaritytechtools-0.2.0-py3-none-any.whl:
Publisher:
workflow.yml on jackklika/solidaritytechtools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
solidaritytechtools-0.2.0-py3-none-any.whl -
Subject digest:
0fb6eb2cb6981374166be1d73a494c14f12e564df0689ef308cf0195051cbed7 - Sigstore transparency entry: 1915806983
- Sigstore integration time:
-
Permalink:
jackklika/solidaritytechtools@a4dfb3a024ad8fb488331d55768b03decd0ae0fd -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/jackklika
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a4dfb3a024ad8fb488331d55768b03decd0ae0fd -
Trigger Event:
push
-
Statement type: