Skip to main content

Autosend Python SDK

Project description

Autosend Python SDK

Lightweight Python client for the Autosend API. This SDK provides a thin, well documented wrapper around Autosend's HTTP endpoints for managing contacts and sending emails.

Features

  • Easy authentication with an API key
  • Contact management: create, upsert, remove, search, bulk update, delete
  • Sending: transactional single sends and bulk sends with template/dynamic data support
  • Input validation and clear, typed exceptions

Installation

Install from source (recommended for development):

pip install -e .

Install directly from GitHub (replace with the repository owner if published):

pip install git+https://github.com/shreyap2702/autosend-python-sdk.git

Install from PyPI

pip install autosend-shreya-sdk

Notes:

  • The project uses requests for HTTP; it will be installed automatically from pyproject.toml.

Quickstart

  1. Create a client with your API key.
from autosend.client import AutosendClient

client = AutosendClient(api_key="YOUR_API_KEY")
  1. Use resource helpers to manage contacts or send emails.
# Contacts
client.contacts.create_contact(
	email="jane.doe@example.com",
	first_name="Jane",
	last_name="Doe",
	user_id="user_123",
	custom_fields={"company": "Acme"}
)

# Sending a single transactional email
client.sending.send_email(
	to_email="jane.doe@example.com",
	to_name="Jane Doe",
	from_email="noreply@company.com",
	from_name="Company",
	subject="Welcome!",
	html="<h1>Hello {{name}}</h1>",
	dynamic_data={"name": "Jane"}
)

Contact API examples

  • Create contact: client.contacts.create_contact(...)
  • Upsert contact: client.contacts.upsert_contact(...) (creates or updates by email)
  • Remove contacts: client.contacts.remove_contacts([emails])
  • Get contact: client.contacts.get_contact(contact_id)
  • Search by emails: client.contacts.search_by_emails([emails])
  • Bulk update: client.contacts.bulk_update(contacts_list, run_workflow=False)
  • Delete by user ID: client.contacts.delete_by_user_id(user_id)
  • Delete by contact ID: client.contacts.delete_by_id(contact_id)

Refer to the docstrings in autosend/resources/contacts.py for parameter details and examples.

Sending API examples

  • Send a single email: client.sending.send_email(...) — supports attachments, reply-to, unsubscribe options, and template dynamic data.
  • Send bulk emails: client.sending.send_bulk(recipients=..., ...) — up to 100 recipients per request.

Refer to autosend/resources/sending.py for payload and validation rules.

Configuration

  • api_key (required): pass to AutosendClient(api_key=...)
  • base_url (optional): pass base_url="https://api.autosend.com/v1" to target a custom endpoint or mock server.

Error handling

The SDK raises typed exceptions from autosend.errors:

  • AutosendError — base class for SDK errors
  • AuthenticationError — invalid or missing API key (401)
  • RequestError — network or request-level failures
  • ValidationError — invalid input/arguments

Example:

from autosend.client import AutosendClient
from autosend.errors import AutosendError, ValidationError

client = AutosendClient(api_key="YOUR_API_KEY")
try:
	client.contacts.create_contact(email="bad-email", first_name="", last_name="")
except ValidationError as e:
	print("Validation failed:", e)
except AutosendError as e:
	print("Autosend API error:", e)

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

autosend_shreya_sdk-2.0.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autosend_shreya_sdk-2.0.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file autosend_shreya_sdk-2.0.0.tar.gz.

File metadata

  • Download URL: autosend_shreya_sdk-2.0.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for autosend_shreya_sdk-2.0.0.tar.gz
Algorithm Hash digest
SHA256 2410636400c420cced3942d0a0e45400311ffa228892c6803f8a0adf8e18180f
MD5 2a429e55ec7bbff6afbe519c5d95f1a1
BLAKE2b-256 ecb08c4e76a79e99121a32abb7878ab8f567f5c3dd677c53caf7c79d69810c58

See more details on using hashes here.

File details

Details for the file autosend_shreya_sdk-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for autosend_shreya_sdk-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1e2c11deecb947a8dfe98947b2045cff48bf84909f8090ae9a4cf38bbc96446
MD5 a7601cf02c25d7c45fb166580e54758b
BLAKE2b-256 4f84e0c288d699e68b3573e18c946ba9a8426d7577ac1522beced8e9bcc484c3

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