-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from getbento/feat/python3-update
Feat/python3 update
- Loading branch information
Showing
29 changed files
with
3,111 additions
and
2,709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
from .createsend import * | ||
from .client import Client | ||
from .template import Template | ||
from .list import List | ||
from .segment import Segment | ||
from .subscriber import Subscriber | ||
from .campaign import Campaign | ||
from .person import Person | ||
from .administrator import Administrator | ||
from .transactional import Transactional | ||
from . import utils | ||
# -*- coding: utf-8 -*- | ||
__title__ = 'createsend-python' | ||
__author__ = 'Dylan Stein' | ||
__license__ = 'MIT' | ||
__copyright__ = 'Copyright 2017' | ||
|
||
|
||
from createsend.createsend import * | ||
from createsend.client import Client | ||
from createsend.template import Template | ||
from createsend.list import List | ||
from createsend.segment import Segment | ||
from createsend.subscriber import Subscriber | ||
from createsend.campaign import Campaign | ||
from createsend.person import Person | ||
from createsend.administrator import Administrator | ||
from createsend.transactional import Transactional | ||
from createsend import utils | ||
|
||
from createsend.version import __version__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,45 @@ | ||
try: | ||
import json | ||
import json | ||
except ImportError: | ||
import simplejson as json | ||
from .createsend import CreateSendBase, BadRequest | ||
from .utils import json_to_py | ||
import simplejson as json | ||
from createsend.createsend import CreateSendBase | ||
from createsend.utils import json_to_py | ||
|
||
|
||
class Administrator(CreateSendBase): | ||
"""Represents an administrator and associated functionality.""" | ||
"""Represents an administrator and associated functionality.""" | ||
|
||
def __init__(self, auth=None, email_address=None): | ||
self.email_address = email_address | ||
super(Administrator, self).__init__(auth) | ||
def __init__(self, auth=None, email_address=None): | ||
self.email_address = email_address | ||
super(Administrator, self).__init__(auth) | ||
|
||
def get(self, email_address=None): | ||
"""Gets an administrator by email address.""" | ||
params = { "email": email_address or self.email_address } | ||
response = self._get("/admins.json", params=params) | ||
return json_to_py(response) | ||
def get(self, email_address=None): | ||
"""Gets an administrator by email address.""" | ||
params = {"email": email_address or self.email_address} | ||
response = self._get("/admins.json", params=params) | ||
return json_to_py(response) | ||
|
||
def add(self, email_address, name): | ||
"""Adds an administrator to an account.""" | ||
body = { | ||
"EmailAddress": email_address, | ||
"Name": name} | ||
response = self._post("/admins.json", json.dumps(body)) | ||
return json_to_py(response) | ||
def add(self, email_address, name): | ||
"""Adds an administrator to an account.""" | ||
body = { | ||
"EmailAddress": email_address, | ||
"Name": name} | ||
response = self._post("/admins.json", json.dumps(body)) | ||
return json_to_py(response) | ||
|
||
def update(self, new_email_address, name): | ||
"""Updates the details for an administrator.""" | ||
params = { "email": self.email_address } | ||
body = { | ||
"EmailAddress": new_email_address, | ||
"Name": name} | ||
response = self._put("/admins.json", | ||
body=json.dumps(body), params=params) | ||
# Update self.email_address, so this object can continue to be used reliably | ||
self.email_address = new_email_address | ||
def update(self, new_email_address, name): | ||
"""Updates the details for an administrator.""" | ||
params = {"email": self.email_address} | ||
body = { | ||
"EmailAddress": new_email_address, | ||
"Name": name} | ||
response = self._put("/admins.json", | ||
body=json.dumps(body), params=params) | ||
# Update self.email_address, so this object can continue to be used | ||
# reliably | ||
self.email_address = new_email_address | ||
|
||
def delete(self): | ||
"""Deletes the administrator from the account.""" | ||
params = { "email": self.email_address } | ||
response = self._delete("/admins.json", params=params) | ||
def delete(self): | ||
"""Deletes the administrator from the account.""" | ||
params = {"email": self.email_address} | ||
response = self._delete("/admins.json", params=params) |
Oops, something went wrong.