A Python client for the ConvertKit API.
pip install convertkit-py
Copy the sample environment file:
cp .env-sample .env
Edit .env
with your ConvertKit credentials:
CONVERTKIT_API_KEY=your_api_key_here
CONVERTKIT_API_SECRET=your_secret_key_here
CONVERTKIT_FORM_NAME=your_form_name_here
from convertkit import ConvertKit
from dotenv import load_dotenv
import os
# Load environment variables
load_dotenv()
# Initialize the client
kit = ConvertKit(
api_key=os.getenv('CONVERTKIT_API_KEY'),
api_secret=os.getenv('CONVERTKIT_API_SECRET'),
form_name=os.getenv('CONVERTKIT_FORM_NAME')
)
# Create a subscriber
subscriber_data = {
'email': '[email protected]',
'fields': {'first_name': 'John'},
'tags': ['tag1', 'tag2']
}
kit.create_subscriber_with_fields_and_tags(subscriber_data)
- Manage subscribers
- Handle custom fields
- Manage tags
- Work with forms
- Full API coverage
- Clone the repository
- Install development dependencies:
pip install -e ".[dev]"
- Install test dependencies:
pip install pytest python-dotenv
- Create a
.env
file in the project root:
KIT_API_KEY=your_api_key_here
KIT_API_SECRET=your_secret_here
- Run tests:
pytest tests -v
MIT License