中文名称:蟒蛇/强哥界面
django-eloqua的Python项目详细描述
Django的Eloqua实现,WIP!
安装
安装最容易通过pip:
$ pip install django-eloqua
设置
将eLoqua添加到“已安装的应用程序”部分,并将其添加到您的设置中。py:
ELOQUA_SITE_ = 'ACME.Inc' ELOQUA_USERNAME = 'my-api-user' ELOQUA_PASSWORD = 'my-api-user-password'
如果您计划使用“模型”字段,则还应通过south运行迁移:
$ manage.py migrate eloqua
如果要使用LandingPages集成,请添加URL,例如:
# in urls.py url(r'^eloqua/', include('eloqua.urls')),
您可以通过/eloqua/[id]或slug:/eloqua/[id]-[slug]访问您的登陆页面,slug是可选的,因为目前无法通过slug获取登陆页面:(
下面是一些可选设置:
ELOQUA_PROFILE_TIMEOUT = 60 * 60 * 24 # the default amount of time, a profile data is cached in the database ELOQUA_BASE_URL = 'https://secure.eloqua.com/API/REST/1.0' # you might want to override the default base url (eg: local reverse proxy, etc)
用法
您可以通过eLoQuaclient访问该功能,例如,发送邮件:
from eloqua.clients import EloquaClient e = EloquaClient() e.emails.create('foobar-name', 'foobar-subject', 'my-body') # etc. See the docstrings
默认情况下,用户模型使用eloqua_profile属性进行扩展。匹配是通过电子邮件地址完成的。如果在eLoqua中找到用户,则会将联系人ID存储在本地以供将来参考:
from django.contrib.auth.models import User u = User.objects.get(pk=1) print u.eloqua_profile.first_name, u.eloqua_profile.last_name # prints 'foo bar' (or whatever is stored in Eloqua)
您还可以获取此用户的任意联系人字段:
from django.contrib.auth.models import User u = User.objects.get(pk=1) u.eloqua_profile.value_for_field(100171) # this is the default Eloqua domain field # prints 'example.com' (or whatever is stored in Eloqua)
您也可以使用命令行工具,例如:
$ ./application/manage.py send_mail_from_url --url=http://www.example.com/ # this will fetch the url, and create a mail in Eloqua with the body of that url # the default subject/name will be the title of the page (via BeautifulSoup), you # can pass extra variables for the subject and reply-to etc
路线图
- 登录页(以便能够包含它们)
- 与django用户模型耦合/同步?
- 使用eloqua作为标准的smtp django后端,也许吧?
- …
- moar…我主要关注联系人、电子邮件和登陆页面部分,因为这是我们最需要的东西。实现其他功能将相当简单,所以破解并发送一个请求:)