# HG changeset patch # User Peter Sanchez # Date 1574097887 28800 # Mon Nov 18 09:24:47 2019 -0800 # Node ID c214cdebd0b991336793795b15412156baee9654 # Parent 426842ddeef97d6d2c66ee8eded1275ba48e5caa Updating code to be compatiable with Sendy v4.0.4 diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ sendypy |nlshield| ============================== :Info: Simple module to interface with the Sendy API (https://sendy.co/api) -:Version: 0.1.5b +:Version: 0.2.0 :Author: Peter Sanchez (http://www.petersanchez.com) - (http://www.netlandish.com) Dependencies @@ -16,7 +16,9 @@ **NOTE:** -* **Version 1.3b** adds the new "title" variable to the ``create_campaign`` API call. It effects the default ordering of variables in the call. If you're upgrading from a previous version please ensure that you account for the new ordering of variables. This new variable was added in Sendy v2.1.2.6 +* **Version 0.2.0** now requires ``api_key`` varaible for all API calls. This is a required change to the functionality of Sendy as of version 4.0.4. This is a potentially breaking code change. Please update your code to always provide the API key before upgrading to sendypy v0.2.0. + +* **Version 0.1.3b** adds the new "title" variable to the ``create_campaign`` API call. It effects the default ordering of variables in the call. If you're upgrading from a previous version please ensure that you account for the new ordering of variables. This new variable was added in Sendy v2.1.2.6 Installation ============ @@ -42,12 +44,14 @@ Usage is simple :: from sendy.api import SendyAPI - api = SendyAPI(host='https://your-sendy-install.com/sendy/', api_key='YOUR_API_KEY') + api = SendyAPI( + host='https://your-sendy-install.com/sendy/', + api_key='YOUR_API_KEY', + ) -You don't need to set the api_key variable if you're using the -subscribe or unsubscribe methods. You can also provide the optional -"debug" variable (defaults to False). This will print debug into to -stdout when sending a request to your Sendy install. +You can also provide the optional ``debug`` variable (defaults to False). +This will print debug into to stdout when sending a request to your Sendy +install. **Subscribe** :: diff --git a/sendy/__init__.py b/sendy/__init__.py --- a/sendy/__init__.py +++ b/sendy/__init__.py @@ -1,6 +1,8 @@ from __future__ import unicode_literals -VERSION = (0, 1, 5, 'beta', 0) +name = 'sendypy' + +VERSION = (0, 2, 0, 'final', 0) def get_version(): diff --git a/sendy/api.py b/sendy/api.py --- a/sendy/api.py +++ b/sendy/api.py @@ -11,7 +11,7 @@ """ Class used to map to all Sendy API endpoints """ - def __init__(self, host, api_key=None, debug=False): + def __init__(self, host, api_key, debug=False): self.host = host if self.host[-1] != '/': self.host = '{0}/'.format(self.host) @@ -27,7 +27,6 @@ ], extra_param={'boolean': 'true'}, success_message='1', - require_auth=False, method='POST', ) @@ -36,7 +35,6 @@ allowed_param=['list', 'email'], extra_param={'boolean': 'true'}, success_message='1', - require_auth=False, method='POST', ) diff --git a/sendy/binder.py b/sendy/binder.py --- a/sendy/binder.py +++ b/sendy/binder.py @@ -32,7 +32,6 @@ path = config['path'] allowed_param = config.get('allowed_param', []) method = config.get('method', 'GET') - require_auth = config.get('require_auth', True) success_status_code = config.get('success_status_code', 200) success_message = config.get('success_message', None) extra_param = config.get('extra_param', None) @@ -73,8 +72,7 @@ if self.extra_param is not None: self.parameters.update(self.extra_param) - if self.require_auth and self.api.api_key is not None: - self.parameters['api_key'] = self.api.api_key + self.parameters['api_key'] = self.api.api_key def execute(self): # Build the request URL