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.4.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-0.1.4-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autosend_shreya_sdk-0.1.4.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-0.1.4.tar.gz
Algorithm Hash digest
SHA256 883c66f3d0ffdf6144b3bd516c01da4c8e789eacb3af88601887646f2af5b6db
MD5 b5835f6c2911f2214bf90188390df59f
BLAKE2b-256 b8e33acf2a247d788e588e783da7e9370116dc698acc2835c83fd65f1861e388

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for autosend_shreya_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c0a8330eadbca9275fb5c551673eb3392644403956a6f2afd19304bd4d34f701
MD5 a45cb5ca61b7b11d80ef445ac9e3dfd2
BLAKE2b-256 911ae520d59d4d68b49fcfc488a7d02f01e6aa4dcf9c88999677dd17e3e81868

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