dyninc/dyn-python — pull request #23 by dyn-tolson (2014-11-12 21:41:24+00:00)
Title: Suppression Fixes

Re the first commit, 7868f82: When I run this:

```python
from dyn.mm.accounts import get_all_suppressions
# where startdate & enddate are datetime.datetime objects without tzinfo set:
get_all_suppressions(startdate, enddate, startindex=whatever)
```

I get an obscure error; the traceback goes into the files I changed, but here's the kind of exceptions I'd get: `ValueError: 'z' is a bad directive in format '%Y-%m-%dT%H:%M:%S%z'`.

This seems to be because python 2.7 doesn't support %z in datetime.datetime.strptime; see http://bugs.python.org/issue6641 for details. This is fixed in python 3.2 apparently, but people running python 2.7 will probably want this. I don't _think_ I damaged anything since the API calls I'm making seem to use both of the utility functions I changed.

The second commit (9cbf288) is to add a field to the Suppressions that is provided by the API; it's undocumented in the official help but it does show up in the API output, and some folks use it to know what kind of suppressions were added to their accounts after a send:

```python
{u'suppressions': [{u'emailaddress': u'XXXXXXXXXX',
u'reasontype': u'hardbounce',
u'suppresstime': u'2014-11-11T15:52:53+00:00'},
{u'emailaddress': u'XXXXXXXXXX',
u'reasontype': u'hardbounce',
u'suppresstime': u'2014-11-11T15:02:13+00:00'},
{u'emailaddress': u'XXXXXXXXXX',
u'reasontype': u'hardbounce',
u'suppresstime': u'2014-11-11T15:02:13+00:00'},
{u'emailaddress': u'XXXXXXXXXX',
u'reasontype': u'hardbounce',
u'suppresstime': u'2014-11-11T15:02:04+00:00'}]}
```