Compare commits
8 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b2113bcd88 | ||
![]() |
860355f8af | ||
![]() |
3591b7e317 | ||
![]() |
ec3fd0b2fb | ||
![]() |
4f618e80ca | ||
![]() |
42cddaf6c0 | ||
![]() |
ac6efbb589 | ||
![]() |
39193bb27b |
18
CHANGELOG.md
18
CHANGELOG.md
|
@ -5,6 +5,24 @@ All notable changes to rattail-mailchimp will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## v0.3.3 (2024-07-05)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- define `host_key` for MailChimp -> Rattail import
|
||||||
|
|
||||||
|
## v0.3.2 (2024-07-01)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- remove legacy command definitions
|
||||||
|
|
||||||
|
## v0.3.1 (2024-06-14)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- fallback to `importlib_metadata` on older python
|
||||||
|
|
||||||
## v0.3.0 (2024-06-10)
|
## v0.3.0 (2024-06-10)
|
||||||
|
|
||||||
### Feat
|
### Feat
|
||||||
|
|
11
README.md
Normal file
11
README.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
# rattail_mailchimp
|
||||||
|
|
||||||
|
Rattail is a retail software framework, released under the GNU General
|
||||||
|
Public License.
|
||||||
|
|
||||||
|
This package contains software interfaces for the
|
||||||
|
[MailChimp](https://mailchimp.com/) system.
|
||||||
|
|
||||||
|
Please see the [Rattail Project](https://rattailproject.org/) for more
|
||||||
|
information.
|
14
README.rst
14
README.rst
|
@ -1,14 +0,0 @@
|
||||||
|
|
||||||
rattail_mailchimp
|
|
||||||
=================
|
|
||||||
|
|
||||||
Rattail is a retail software framework, released under the GNU General
|
|
||||||
Public License.
|
|
||||||
|
|
||||||
This package contains software interfaces for the `MailChimp`_ system.
|
|
||||||
|
|
||||||
.. _`MailChimp`: https://mailchimp.com/
|
|
||||||
|
|
||||||
Please see the `Rattail Project`_ for more information.
|
|
||||||
|
|
||||||
.. _`Rattail Project`: https://rattailproject.org/
|
|
|
@ -6,9 +6,9 @@ build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rattail-mailchimp"
|
name = "rattail-mailchimp"
|
||||||
version = "0.3.0"
|
version = "0.3.3"
|
||||||
description = "Rattail Software Interfaces for MailChimp"
|
description = "Rattail Software Interfaces for MailChimp"
|
||||||
readme = "README.rst"
|
readme = "README.md"
|
||||||
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]
|
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]
|
||||||
license = {text = "GNU GPL v3+"}
|
license = {text = "GNU GPL v3+"}
|
||||||
classifiers = [
|
classifiers = [
|
||||||
|
@ -34,10 +34,6 @@ dependencies = [
|
||||||
rattail_mailchimp = "rattail_mailchimp.config:MailchimpConfigExtension"
|
rattail_mailchimp = "rattail_mailchimp.config:MailchimpConfigExtension"
|
||||||
|
|
||||||
|
|
||||||
[project.entry-points."rattail.subcommands"]
|
|
||||||
import-mailchimp = "rattail_mailchimp.commands:ImportMailChimp"
|
|
||||||
|
|
||||||
|
|
||||||
[project.entry-points."rattail.typer_imports"]
|
[project.entry-points."rattail.typer_imports"]
|
||||||
rattail_mailchimp = "rattail_mailchimp.commands"
|
rattail_mailchimp = "rattail_mailchimp.commands"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# -*- coding: utf-8; -*-
|
# -*- coding: utf-8; -*-
|
||||||
|
|
||||||
from importlib.metadata import version
|
try:
|
||||||
|
from importlib.metadata import version
|
||||||
|
except ImportError:
|
||||||
|
from importlib_metadata import version
|
||||||
|
|
||||||
|
|
||||||
__version__ = version('rattail-mailchimp')
|
__version__ = version('rattail-mailchimp')
|
||||||
|
|
|
@ -26,7 +26,7 @@ Rattail Commands for MailChimp integration
|
||||||
|
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
from rattail.commands import rattail_typer, ImportSubcommand
|
from rattail.commands import rattail_typer
|
||||||
from rattail.commands.typer import importer_command, typer_get_runas_user
|
from rattail.commands.typer import importer_command, typer_get_runas_user
|
||||||
from rattail.commands.importing import ImportCommandHandler
|
from rattail.commands.importing import ImportCommandHandler
|
||||||
|
|
||||||
|
@ -46,21 +46,3 @@ def import_mailchimp(
|
||||||
config, import_handler_key='to_rattail.from_mailchimp.import')
|
config, import_handler_key='to_rattail.from_mailchimp.import')
|
||||||
kwargs['user'] = typer_get_runas_user(ctx)
|
kwargs['user'] = typer_get_runas_user(ctx)
|
||||||
handler.run(kwargs, progress=progress)
|
handler.run(kwargs, progress=progress)
|
||||||
|
|
||||||
|
|
||||||
class ImportMailChimp(ImportSubcommand):
|
|
||||||
"""
|
|
||||||
Import data to Rattail, from MailChimp API
|
|
||||||
"""
|
|
||||||
name = 'import-mailchimp'
|
|
||||||
description = __doc__.strip()
|
|
||||||
default_handler_spec = 'rattail_mailchimp.importing.mailchimp:FromMailChimpToRattail'
|
|
||||||
|
|
||||||
def get_handler_factory(self, **kwargs):
|
|
||||||
if self.config:
|
|
||||||
spec = self.config.get('rattail.importing', 'mailchimp.handler',
|
|
||||||
default=self.default_handler_spec)
|
|
||||||
else:
|
|
||||||
# just use default, for sake of cmd line help
|
|
||||||
spec = self.default_handler_spec
|
|
||||||
return self.app.load_object(spec)
|
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
Config extensions for rattail-mailchimp
|
Config extensions for rattail-mailchimp
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from rattail.config import ConfigExtension
|
from wuttjamaican.conf import WuttaConfigExtension
|
||||||
|
|
||||||
|
|
||||||
class MailchimpConfigExtension(ConfigExtension):
|
class MailchimpConfigExtension(WuttaConfigExtension):
|
||||||
"""
|
"""
|
||||||
Config extension for rattail-mailchimp
|
Config extension for rattail-mailchimp
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2023 Lance Edgar
|
# Copyright © 2010-2024 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -30,7 +30,6 @@ from collections import OrderedDict
|
||||||
from mailchimp3 import MailChimp
|
from mailchimp3 import MailChimp
|
||||||
|
|
||||||
from rattail import importing
|
from rattail import importing
|
||||||
from rattail.time import localtime, make_utc
|
|
||||||
from rattail_mailchimp import importing as mailchimp_importing
|
from rattail_mailchimp import importing as mailchimp_importing
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +37,9 @@ class FromMailChimpToRattail(importing.ToRattailHandler):
|
||||||
"""
|
"""
|
||||||
Handler for MailChimp -> Rattail cache import
|
Handler for MailChimp -> Rattail cache import
|
||||||
"""
|
"""
|
||||||
|
host_key = 'mailchimp'
|
||||||
host_title = "MailChimp"
|
host_title = "MailChimp"
|
||||||
|
generic_host_title = "MailChimp"
|
||||||
|
|
||||||
def get_importers(self):
|
def get_importers(self):
|
||||||
importers = OrderedDict()
|
importers = OrderedDict()
|
||||||
|
@ -53,7 +54,7 @@ class FromMailChimp(importing.Importer):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
super(FromMailChimp, self).setup()
|
super().setup()
|
||||||
|
|
||||||
self.api_key = self.config.require('mailchimp', 'api_key')
|
self.api_key = self.config.require('mailchimp', 'api_key')
|
||||||
self.mailchimp = MailChimp(self.api_key)
|
self.mailchimp = MailChimp(self.api_key)
|
||||||
|
@ -65,10 +66,10 @@ class FromMailChimp(importing.Importer):
|
||||||
# issue..since we clearly have a UTC value
|
# issue..since we clearly have a UTC value
|
||||||
value = value[:-6]
|
value = value[:-6]
|
||||||
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S')
|
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S')
|
||||||
dt = localtime(self.config, dt, from_utc=True)
|
dt = self.app.localtime(dt, from_utc=True)
|
||||||
else:
|
else:
|
||||||
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S%z')
|
dt = datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S%z')
|
||||||
dt = localtime(self.config, dt)
|
dt = self.app.localtime(dt)
|
||||||
return dt
|
return dt
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ class MailChimpListImporter(FromMailChimp, mailchimp_importing.model.MailChimpLi
|
||||||
return {
|
return {
|
||||||
'id': mclist['id'],
|
'id': mclist['id'],
|
||||||
'name': mclist['name'],
|
'name': mclist['name'],
|
||||||
'date_created': make_utc(date_created),
|
'date_created': self.app.make_utc(date_created),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,6 +161,6 @@ class MailChimpListMemberImporter(FromMailChimp, mailchimp_importing.model.MailC
|
||||||
'status': member['status'],
|
'status': member['status'],
|
||||||
# TODO: this API endpoint does not appear to include this field?
|
# TODO: this API endpoint does not appear to include this field?
|
||||||
# 'unsubscribe_reason': member.get('unsubscribe_reason'),
|
# 'unsubscribe_reason': member.get('unsubscribe_reason'),
|
||||||
'last_changed': make_utc(last_changed),
|
'last_changed': self.app.make_utc(last_changed),
|
||||||
'source': member['source'],
|
'source': member['source'],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue