Skip to main content

convoy-python

Convoy SDK for Python

This is the Convoy Python SDK. This SDK contains methods for easily interacting with Convoy's API. Below are examples to get you started. For additional examples, please see our official documentation at (https://convoy.readme.io/reference)

Installation

Install convoy-python with

pip install convoy-python

Setup Client

Next, import the convoy module and setup with your auth credentials.

from convoy import Convoy
convoy = Convoy({"api_key":"your_api_key", "project_id": "your_project_id"})

The SDK also supports authenticating via Basic Auth by defining your username and password.

In the event you're using a self-hosted convoy instance, you can define the uri as part of what is passed into the convoy's constructor.

convoy = Convoy({ "api_key": 'your_api_key', "uri": 'self-hosted-instance', "project_id": "your_project_id"})

Usage

Get all groups

(response, status) = convoy.group.all({ "perPage": 10, "page": 1 })

Create an Endpoint

An endpoint represents a target URL to receive events.

endpointData = {
    "url": "https://0d87-102-89-2-172.ngrok.io",
    "description": "Default Endpoint",
    "secret": "endpoint-secret",
    "events": ["*"],
  }

(response, status) = convoy.endpoint.create({}, endpointData)
endpoint_id = response["data"]["uid"]

Sending an Event

To send an event, you'll need the uid we created in the earlier section.

eventData = {
    "endpoint_id": endpoint_id,
    "event_type": "payment.success",
    "data": {
      "event": "payment.success",
      "data": {
        "status": "Completed",
        "description": "Transaction Successful",
        "userID": "test_user_id808",
      },
    },
  }

(response, status) = convoy.event.create({}, eventData)

Testing

pytest ./test/test.py

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

Metadata

Release files for convoy-python 0.2.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 convoy-python 0.2.0
File Size Uploaded
convoy-python-0.2.0.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for convoy-python 0.2.0
File Interpreter ABI Platform
convoy_python-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.4 kB

Release files / convoy-python-0.2.0.tar.gz

Download URL convoy-python-0.2.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9d535f3788c5aa91a946b6c68bf9067328655f300193d7aee5aa9982490fd8aa
BLAKE2b-256 checksum
How to use checksums
a48e16f2135661ae64ad0330b8f821612a4ac884610ebef99e79abd615365292
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / convoy_python-0.2.0-py3-none-any.whl

Download URL convoy_python-0.2.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca6d839d8f7493f90e8937c4d528665367137b98a2e6f9c603b357765c09346f
BLAKE2b-256 checksum
How to use checksums
d0108afef4d791f7f16f21dc1d16834b6554ba4b21fb48e5d4ac19a197d193f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.2.0 This release

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