-
Notifications
You must be signed in to change notification settings - Fork 1
pyopenemm
pratz edited this page Sep 1, 2012
·
12 revisions
OpenEMM - http://www.openemm.org/
OpenEMM is a feature-rich web-based enterprise application for email marketing, newsletters and service mails.
You can find the documentation to install openemm and its web services here
http://sourceforge.net/projects/openemm/files/OpenEMM%20documentation/Documentation%20%28latest%20versions%29/
Required Software's :
- Python 2.6 or higher
- Suds 0.4 ( python SOAP client )
Configuration :
Configure openemm wsdl url, username and password in pyopenemm/config.py like so
OPENEMM_URL = 'http://172.16.0.153:8080/cms_services/urn:agnitas-webservice?wsdl'
WEBSERVICE_USER = 'test_user'
WEBSERVICE_PASSWORD = 'test_123'
Quick Start :
In [1]: from pyopenemm.connection.connect import create_connection
In [2]: from pyopenemm.webservice.service import OpenEMM
In [3]: client = create_connection() # connect to webservice , returned is suds client
In [4]: openemm = OpenEMM(client) # openemm class
In [5]: subscriber = openemm.find_subscriber(('email','[email protected]')) # get subcriber by email , args is tuple where 1st element is key column and 2nd is value
In [6]: subscriber # returns the id of subscriber
Out[6]: 3
In [7]: subscriber_details = openemm.get_subscriber(subscriber) # get's a subscriber by id (integer)
In [8]: from pprint import pprint
In [9]: pprint(subscriber_details) # returns dict of subscriber info
{change_date: 2004-06-16 22:47:10,
change_date_day_date: 16,
change_date_hour_date: 22,
change_date_minute_date: 47,
change_date_month_date: 6,
change_date_second_date: 10,
change_date_year_date: 2004,
creation_date: 2004-06-16 22:40:01,
creation_date_day_date: 16,
creation_date_hour_date: 22,
creation_date_minute_date: 40,
creation_date_month_date: 6,
creation_date_second_date: 1,
creation_date_year_date: 2004,
customer_id: 3,
datasource_id: 0,
email: [email protected],
firstname: pratz,
gender: 0,
lastname: NEV,
mailtype: None,
title: None}
In [10]: user_dict = {'email':'[email protected]','firstname':'openemmfirstname','lastname':'openemmlastname','gender':0}
In [11]: """
Four parameters of add_subscriber() method
user_dict = Dictionary containing user information
double_check - If True, check if subscriber is already in database
key_column - column used for double_check
overwrite - If True, subscriber gets updated
""""
In [12]: new_subscriber = openemm.add_subscriber(user_dict,True,'email',True) # add new subscriber to openemm
In [13]: new_subscriber # returns new subscriber's id
Out[13]: 4
**More to follow .. ........ .. . **