Skip to main content

A simple, class-based Python wrapper for the MailerLite API.

Project description

Python MailerLite Wrapper

A simple, class-based Python wrapper to make common MailerLite API calls more convenient.

Installation

Install the package from PyPI:

pip install mailerlite-wrapper

# USAGE
from mailerlite_wrapper import MailerLiteWrapper
import os

# It's recommended to load your API key from environment variables
# and not to hard-code it in your script.
API_KEY = os.getenv("MAILER_LITE_API_KEY")

# Initialize the wrapper
ml = MailerLiteWrapper(api_key=API_KEY)

# Now you can use the helper methods
try:
    # Get all active subscribers
    subscribers = ml.get_all_active_subscribers()
    print("Fetched subscribers.")

    # Create a new subscriber
    new_subscriber = ml.create_subscriber(
        email="new.subscriber@example.com",
        name="John",
        last_name="Doe"
    )
    print("Created a new subscriber.")

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

# License

from mailerlite_wrapper import MailerLiteWrapper
import os

# It's recommended to load your API key from environment variables
# and not to hard-code it in your script.
API_KEY = os.getenv("MAILER_LITE_API_KEY")

# Initialize the wrapper
ml = MailerLiteWrapper(api_key=API_KEY)

# Now you can use the helper methods
try:
    # Get all active subscribers
    subscribers = ml.get_all_active_subscribers()
    print("Fetched subscribers.")

    # Create a new subscriber
    new_subscriber = ml.create_subscriber(
        email="new.subscriber@example.com",
        name="John",
        last_name="Doe"
    )
    print("Created a new subscriber.")

except Exception as e:
    print(f"An error occurred: {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

mailerlite_wrapper-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

mailerlite_wrapper-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file mailerlite_wrapper-0.1.0.tar.gz.

File metadata

  • Download URL: mailerlite_wrapper-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for mailerlite_wrapper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 86e5dc5bca2a099004eb35259b8393ace4db7989d0980b68ff50950d1ce0a34e
MD5 c1afc6ff208cb76ee77a3448543b4e1a
BLAKE2b-256 3199ebfa4bf74f33fe73cf489fb8a7d05e7e201d3982cdf5662e354e7bac7a67

See more details on using hashes here.

File details

Details for the file mailerlite_wrapper-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mailerlite_wrapper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b6ebfb52a99e142692392a2bc22d250989434bac643666e3a769562ae8b72cab
MD5 32f6039a0cddfd8711dcc012cfd204ff
BLAKE2b-256 388e28a0fb566efc0c9b1fd4173dd82716526421c5c6231c12582338ead8f75a

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