{ "info": { "author": "Micah Carrick", "author_email": "micah@quixotix.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "django-chimpusers\n=================\n\nIntegrates users from Django's authentication system `django.contrib.auth` with\na [MailChimp][1] email marketing list. Provides a model to store opt-in data \nand a form factory to allow users to edit their [interest groups][3].\n\n\nRequirements\n------------\n\n* [MailSnake][10], a Python wrapper for the [MailChimp v1.3 API][2]. You can\n install MailSnake using `easy_install` or `pip`:\n\n pip install mailsnake\n\n* The API key for your MailChimp account. [Where can I find my API key?][4]\n* The ID of the list you want to integrate with. [How can I find my List ID?][5]\n\n\nInstallation\n------------\n\nFor the latest stable version, install using `easy_install` or `pip`:\n\n pip install django-chimpusers\n\nFor the latest development version, install from the git repository.\n\n git clone git@github.com:Quixotix/django-chimpusers.git\n setup.py install django-chimpusers\n\nThen, add `chimpusers` to your installed apps and sync the database:\n\n ./manage.py syncdb\n\n\nSettings\n--------\n\n* `MAILCHIMP_API_KEY` - [required] Your MailChimp API key. \n* `MAILCHIMP_LIST_ID` - [required] The list ID of the MailChimp list you want to integrate\n with.\n* `MAILCHIMP_TEST_IP` - [optional] A __public__ IP address to use with the test cases. This \n must be a public IP for the tests to pass.\n\n\nHow it Works\n------------\n\n### The UserSubscription Model\n\nA `UserSubscription` model is created each time a `User` is created. This model \nsimply provides some convenience methods that wrap MailSnake calls to the \nMailChimp API. It also stores the user's subscription status, opt-in IP addresss, \nand opt-in date.\n\nYou would typically use `UserSubscription` when you register or activate new\nmembers or in a specific view for subscribing to your email list. (You make\nsure your users are opting in right? They should be physically checking a check \nbox, clicking a big \"subscribe\" button, etc. Don't spam folks, they don't like\nit)\n\n__UserSubscription.subscribe()__\n\nThe `UserSubscription.subscribe()` calls [listSubscribe][6], automatically \nadding the list ID, the user's email, the user's first name, and the user's \nlast name. All other parameters defined for [listSubscribe][6] can be passed \nto `UserSubscription.subscribe()` as keyword arguments (again, it just wraps\nMailSnake).\n\n from chimpusers.models import UserSubscription\n \n # ...\n \n subscription = UserSubscription.objects.get(user=request.user)\n subscription.subscribe() # double_optin is True by default\n\nIf the MailChimp API returns an error (say the email is already subscribed), you\ncan catch the `MailChimpError` eception.\n\n from chimpusers.models import UserSubscription\n from chimpusers.exceptions import MailChimpError\n \n # ...\n \n subscription = UserSubscription.objects.get(user=request.user)\n try:\n subscription.subscribe() # double_optin is True by default\n except MailChimpError as e:\n # Handle exception. Message will be that returned by MailChimp.\n pass\n\nWhen you subscribe a user you should save the user's IP address and a timestamp \nas opt-in \"proof\".\n\n from datetime import datetime\n from chimpusers.models import UserSubscription\n \n # ...\n \n subscription = UserSubscription.objects.get(user=request.user)\n optin_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n if 'HTTP_X_FORWARDED_FOR' in request.META: # IP forwarded from proxy\n optin_ip = request.META['HTTP_X_FORWARDED_FOR']\n else:\n optin_ip = request.META['REMOTE_ADDR']\n merge_vars = {'OPTIN_IP': optin_ip, 'OPTIN_TIME': optin_time}\n \n subscription.subscribe(merge_vars=merge_vars)\n\nAnd just to drive home the point that the `UserSubscription.subscribe()` just\nwraps a MailSnake call to [listSubscribe][6]...\n\n from chimpusers.models import UserSubscription\n \n # ...\n \n subscription = UserSubscription.objects.get(user=request.user)\n subscription.subscribe(email_type=\"text\", \n double_optin=False, \n update_existing=True, \n replace_interests=False, \n send_welcome=True)\n\n\n__UserSubscription.update()__\n\nThe `UserSubscription.update()` calls [listMemberUpdate][7], automatically \nadding the list ID, the user's email, the user's first name, and the user's \nlast name. All other parameters defined for [listMemberUpdate][7] can be passed \nto `UserSubscription.update()` as keyword arguments.\n\n from chimpusers.models import UserSubscription\n \n # ...\n \n subscription = UserSubscription.objects.get(user=request.user)\n merge_vars = {\"GROUPINGS\": [{\"name\":\"Interest Groups\", \n \"groups\":\"Monthly Newsletter,New Products\"}]}\n subscription.update(merge_vars=merge_vars)\n\n\n__UserSubscription.unsubscribe()__\n\nThe `UserSubscription.unsubscribe()` calls [listUnsubscribe][8], automatically \nadding the list ID and the user's email. All other parameters defined for \n[listUnsubscribe][8] can be passed to `UserSubscription.unsubscribe()` as \nkeyword arguments.\n\n from chimpusers.models import UserSubscription\n \n # ...\n \n subscription = UserSubscription.objects.get(user=request.user)\n subscription.unsubscribe(send_goodbye=False, send_notify=True)\n\n\n__UserSubscription.sync()__\n \nThe `UserSubscription` model provides the `sync` method to synchronize the model\nfields with the MailChimp API. Since the user or an administrator can manipulate\nsubscriptions from the MailChimp website and you _may_ not have any [webhooks][9]\nsetup yet, syncing the `UserSubscription` can come in handy.\n\n from chimpusers.models import UserSubscription\n \n # ...\n \n subscription = UserSubscription.objects.get(user=request.user)\n subscription.sync()\n # the following fields are now in sync with MailChimp\n # subscription.status\n # subscription.optin_ip\n # subscription.optin_time\n\n\n### The groups_form_factory Form Factory\n\nOne of the great features of MailChimp is to segregate your list into various\ninterest [groups][3]. This allows you to maintain one list for your website's \nusers and allow them to sign up for one or more groups. \n\nFor example, an e-commerce website may have a list of all their customers, and\ngroups to allow their customers to recieve a monthly newsletter, another group\nfor new product announcements, and another group for holiday promotions.\n\nThe `groups_form_factory()` function dynamically generates a form for opting in\nand out of your list's groups. This could be used in a view allowing existing\nsubscribers to modify their group preferences or combined with a registration\nform to allow new subscribers to opt-in to specific groups at sign up.\n\n from chimpusers.models import UserSubscription\n from chimpusers.forms import groups_form_factory\n from datetime import datetime\n \n # ...\n \n subscription = UserSubscription.objects.get(user=request.user)\n GroupsForm = groups_form_factory(request.user.email)\n \n if request.method == 'POST':\n form = GroupsForm(request.post)\n if form.is_valid():\n merge_vars = {'GROUPINGS': [form.merge_var]}\n if subscription.is_subscribed():\n # update user's groups\n subscription.update(merge_vars=merge)\n else:\n # subscribe\n optin_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n if 'HTTP_X_FORWARDED_FOR' in request.META:\n optin_ip = request.META['HTTP_X_FORWARDED_FOR']\n else:\n optin_ip = request.META['REMOTE_ADDR']\n merge['OPTIN_IP'] = optin_ip\n merge['OPTIN_TIME'] = optin_time\n subscription.subscribe(merge_vars=merge)\n else:\n form = GroupsForm()\n \n # ...\n \n\n[1]: http://mailchimp.com\n[2]: http://apidocs.mailchimp.com/api/1.3/\n[3]: http://mailchimp.com/features/groups/\n[4]: http://kb.mailchimp.com/article/where-can-i-find-my-api-key/\n[5]: http://kb.mailchimp.com/article/how-can-i-find-my-list-id/\n[6]: http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php\n[7]: http://apidocs.mailchimp.com/api/1.3/listupdatemember.func.php\n[8]: http://apidocs.mailchimp.com/api/1.3/listunsubscribe.func.php\n[9]: http://apidocs.mailchimp.com/webhooks/\n[10]: https://github.com/leftium/mailsnake", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Quixotix/django-chimpusers", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-chimpusers", "package_url": "https://pypi.org/project/django-chimpusers/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-chimpusers/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/Quixotix/django-chimpusers" }, "release_url": "https://pypi.org/project/django-chimpusers/0.1.8/", "requires_dist": null, "requires_python": null, "summary": "Integrate Django users with a MailChimp mailing list.", "version": "0.1.8" }, "last_serial": 789283, "releases": { "0.1.0": [], "0.1.4": [ { "comment_text": "built for Linux-3.5.3-1.fc17.x86_64-x86_64-with-glibc2.2.5", "digests": { "md5": "c9e725fe05f10176d2facf87c3c80880", "sha256": "04f3820638c2151ba9cf2725e94a18f1e09659cbe8bc4a3bbf4ffd22d31133c1" }, "downloads": -1, "filename": "django-chimpusers-0.1.4.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "c9e725fe05f10176d2facf87c3c80880", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 19137, "upload_time": "2012-09-15T17:28:04", "url": "https://files.pythonhosted.org/packages/94/c2/0b3841f4f3faeb77805cd7f25cb84dcdf7668f1a9258059bbbef3eed98d5/django-chimpusers-0.1.4.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "78eccc7f8f1b3e5d601a024787fd7a43", "sha256": "0c50b7798c141334757a31a3f1c6c1a303a697c02135fbdb3aa7af36aed84b1c" }, "downloads": -1, "filename": "django_chimpusers-0.1.4-py2.7.egg", "has_sig": false, "md5_digest": "78eccc7f8f1b3e5d601a024787fd7a43", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 26956, "upload_time": "2012-09-15T16:13:58", "url": "https://files.pythonhosted.org/packages/33/41/c2d9ae009598442487e64e36ba64d13492d9dd8133f42cce898fccf68c71/django_chimpusers-0.1.4-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "c04fc3dec9e4ba0c0f9e52a2444905ee", "sha256": "dd74f5640efd1989b0f43dd843fa8da9e403578aa4567e1fbbe99021270c5101" }, "downloads": -1, "filename": "django-chimpusers-0.1.4.tar.gz", "has_sig": false, "md5_digest": "c04fc3dec9e4ba0c0f9e52a2444905ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10093, "upload_time": "2012-09-15T17:28:11", "url": "https://files.pythonhosted.org/packages/cf/38/55dfb826811bd875e81e965c42a118137045a44f3b51377ea209602e8c1e/django-chimpusers-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "built for Linux-3.5.3-1.fc17.x86_64-x86_64-with-glibc2.2.5", "digests": { "md5": "028322317829cdd011442ef1d874be0f", "sha256": "cb1077b3097408b7c08b7efff11a7d81f0a0c9bde190b7dad6dc3a551fa7c6d6" }, "downloads": -1, "filename": "django-chimpusers-0.1.5.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "028322317829cdd011442ef1d874be0f", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 29319, "upload_time": "2012-09-15T17:51:02", "url": "https://files.pythonhosted.org/packages/20/c6/bb39a079dc5a3635cb5aa9ed6000a8df05eab77583f676a5e26b954e23b3/django-chimpusers-0.1.5.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "430aff2a8276d6ac36f93fd03431e5d1", "sha256": "05b61863f1d38e2ff98273bce788d1394d3d247c086ac614a0c145a803565fd1" }, "downloads": -1, "filename": "django-chimpusers-0.1.5.tar.gz", "has_sig": false, "md5_digest": "430aff2a8276d6ac36f93fd03431e5d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14644, "upload_time": "2012-09-15T17:51:07", "url": "https://files.pythonhosted.org/packages/52/5a/afe91eaa57426590524d168a968a892216d05218315e7393526bd56426b0/django-chimpusers-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "0f753f113cbb01ece37176cd9dc730db", "sha256": "ea41776170bb5dc8f1a86b61263f5b3f2eb9c2a188c37acc79b9541ac1745d9c" }, "downloads": -1, "filename": "django-chimpusers-0.1.6.tar.gz", "has_sig": false, "md5_digest": "0f753f113cbb01ece37176cd9dc730db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14639, "upload_time": "2012-09-15T18:01:39", "url": "https://files.pythonhosted.org/packages/bf/de/6afd44077964455c9bab067f68c6099b1486f54dd3478b0dd7a7ebbbfff8/django-chimpusers-0.1.6.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "a07bf9ab40c7eace0f655a098ca3c8b3", "sha256": "0e07151802468f1ce487e639ef2649c57cd504f1be712c47280eeaf17cb4131f" }, "downloads": -1, "filename": "django-chimpusers-0.1.8.tar.gz", "has_sig": false, "md5_digest": "a07bf9ab40c7eace0f655a098ca3c8b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15156, "upload_time": "2012-09-15T18:27:34", "url": "https://files.pythonhosted.org/packages/58/0b/70b5c370925a3fbf3717ad103df0ce35c14c1b06ec583bf5f5cdc97cbb2b/django-chimpusers-0.1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a07bf9ab40c7eace0f655a098ca3c8b3", "sha256": "0e07151802468f1ce487e639ef2649c57cd504f1be712c47280eeaf17cb4131f" }, "downloads": -1, "filename": "django-chimpusers-0.1.8.tar.gz", "has_sig": false, "md5_digest": "a07bf9ab40c7eace0f655a098ca3c8b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15156, "upload_time": "2012-09-15T18:27:34", "url": "https://files.pythonhosted.org/packages/58/0b/70b5c370925a3fbf3717ad103df0ce35c14c1b06ec583bf5f5cdc97cbb2b/django-chimpusers-0.1.8.tar.gz" } ] }