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-0.1.3.tar.gz (13.9 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-0.1.3-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autosend_shreya_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 13.9 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-0.1.3.tar.gz
Algorithm Hash digest
SHA256 72a4ad8f50b8558d4f509157249be99a99da01c26c9e6635f62e393b62e6fd50
MD5 b50e7a3fed8d2579c0490fcbb3251ced
BLAKE2b-256 7e4ef8eea29ecde09f609cc0a8ad173a9218a4937cfdd1154de565b478db4d0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for autosend_shreya_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8e1b84cd4cd940dae4f1d35cf9abe5c92f0a946f94422f6ab79df6b2bdc8a2c4
MD5 af8317937d85d66d02a544f4fb724699
BLAKE2b-256 20d797fdba88691cfdb28dd96c0efb85558f92808092fbbbc7a1cd763679b2fc

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