Skip to main content

A Python SDK for the Email Octopus V2 API.

Project description

Email Octopus Python SDK

A friendly, modern Python wrapper for the Email Octopus API v2.

Features

  • Full support for all Email Octopus API v2 endpoints.
  • Intuitive methods and object-oriented design.
  • Built-in handling for authentication and API errors.
  • Type-hinted for a better development experience.

Installation

You can install the library via pip:

pip install emailoctopus-python-sdk

Usage

First, get your API key from your Email Octopus account.

from emailoctopus_sdk import Client
import os

# It's recommended to load your API key from an environment variable
api_key = os.environ.get("EMAILOCTOPUS_API_KEY")

if not api_key:
    raise ValueError("EMAILOCTOPUS_API_KEY environment variable not set.")

client = Client(api_key=api_key)

try:
    # Example: Get all mailing lists
    lists = client.get_all_lists()
    for lst in lists:
        print(f"List ID: {lst['id']}, Name: {lst['name']}, Subscribers: {lst['counts']['subscribed']}")

    # Example: Get a specific list
    a_specific_list_id = "YOUR_LIST_ID_HERE"
    list_details = client.get_list(a_specific_list_id)
    print(f"\nDetails for list {list_details['name']}:")
    print(list_details)

except Exception as e:
    print(f"An error occurred: {e}")

Development

To set up the development environment:

  1. Clone the repository: git clone https://github.com/dayluke/emailoctopus-python.git
  2. Create and activate a virtual environment.
  3. Install dependencies: pip install -e .[dev]
  4. Run tests: pytest

Contributing

Contributions are welcome! Please read the CONTRIBUTING file for details on how to get started.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

emailoctopus_sdk-0.2.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

emailoctopus_sdk-0.2.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file emailoctopus_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: emailoctopus_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for emailoctopus_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4ba527ec97e8b3bcdda2fb1267366c811494cd764ae891f8fbb8b46bcae14fef
MD5 eb26f25a66982e417121be60432579b1
BLAKE2b-256 ea77ddd76b5c972b957b8a822688c3dbe26ead3e8714b408d0e1e48478cee251

See more details on using hashes here.

File details

Details for the file emailoctopus_sdk-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for emailoctopus_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d306a5057015dabfefb7898cc8e688143128a1b02812b5ce29b84e7902ae1ef
MD5 ae83ccabdd9a2ccdae9467b7f277e255
BLAKE2b-256 5d2fbbd6f26c698a1293d68b34697548b4c0abdff21e2c35dc0b1cad76dd3889

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