Skip to main content

coconnect

Send what users do on your platform to CoConnect Hub, named the way your platform already names it. CoConnect matches each event to the right task and rewards the member. Everything runs on your server; nothing is added to your web pages.

pip install coconnect

1. Keep the CoConnect ID

Members arrive from CoConnect with their CoConnect ID in the link (?cc_id=ck_...). Read it on your server when they land and keep it in a first-party cookie or the session, so it survives sign-up redirects such as Google sign-in:

from coconnect import cc_id_from_url

# Flask shown; any framework works the same way.
@app.after_request
def keep_cc_id(response):
    cc_id = cc_id_from_url(request.full_path)
    if cc_id:
        response.set_cookie("cc_id", cc_id, max_age=30 * 86400, httponly=True, secure=True, samesite="Lax")
    return response

# At sign-up, save request.cookies.get("cc_id") with the new account.

2. Send events

import os
from coconnect import CoConnect

hub = CoConnect(
    token=os.environ["COCONNECT_TOKEN"],
    secret=os.environ.get("COCONNECT_SECRET"),  # optional: your signing secret
)

# When a user signs up:
hub.send("user_registered", user="u_1001", cc_id=user.cc_id)

# Anything else, in your own words, with whatever details you have:
hub.send("ftd", user="u_1001", amount=75, currency="USD", id="dep_10482")
hub.send("kyc_failed", user="u_1001", status="failed", reason="Document unreadable")
  • user is required: your own ID for the user.
  • cc_id links the user to their CoConnect account. Send it at least once per user.
  • id is your reference for the event. If you leave it out, the SDK generates one, so a retried request is never counted twice.
  • Any other keyword arguments are kept as details of the event. Emails and phone numbers are hashed by CoConnect on arrival.
  • Batching: send_batch([...]) sends up to 50 events at once.

Signed requests

If CoConnect gave you a signing secret (ccs_...), pass it as secret. Every request is then signed with a timestamp, so it cannot be altered or replayed, even by someone who has seen your token. Without the client, sign_request(secret, timestamp, method, path, body) builds the X-CC-Signature value.

Also handled

  • Retries: network errors, 429 and 5xx responses are retried with backoff.
  • Errors: a bad token, a bad signature or a malformed event raises CoConnectError.
  • No dependencies beyond the standard library.

Keep your token and secret on the server.

Metadata

Release files for coconnect 1.1.0

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

Source distribution (sdist)

Source distribution for coconnect 1.1.0
File Size Uploaded Provenance
coconnect-1.1.0.tar.gz 5.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 10.7 kB

Release files / coconnect-1.1.0.tar.gz

Download URL coconnect-1.1.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
20fc53757730b498e1e944622e645d1b155840041ce77cc5bc61cff580eb6223
BLAKE2b-256 checksum
How to use checksums
557d1da5910b0625c2d64505d255c66640bef52fdfeda141170e992c51013964
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / coconnect-1.1.0-py3-none-any.whl

Download URL coconnect-1.1.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a02195af306ce8689a80a8345d6cb9a3bc5a33a45700d6719a7f5de64eda0bd
BLAKE2b-256 checksum
How to use checksums
5195192c9c6d47ee8e3c28282e5e7ae13e2d2280b7d6e29b68ef1dba245fe201
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for coconnect 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

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