From 70b05b25ee334a7b48809b069aa8185879838b8c Mon Sep 17 00:00:00 2001 From: John Obelenus Date: Wed, 27 Sep 2017 15:39:21 -0400 Subject: [PATCH 1/2] closes #14 --- pyavatax/__init__.py | 2 +- pyavatax/base.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pyavatax/__init__.py b/pyavatax/__init__.py index 3cef352..0d2be47 100644 --- a/pyavatax/__init__.py +++ b/pyavatax/__init__.py @@ -1,4 +1,4 @@ -VERSION = (1, 3, 8) +VERSION = (1, 3, 9) def get_version(): diff --git a/pyavatax/base.py b/pyavatax/base.py index 748d47d..41bddca 100644 --- a/pyavatax/base.py +++ b/pyavatax/base.py @@ -110,7 +110,7 @@ def update(self, *args, **kwargs): if isinstance(_v, klass): getattr(self, k).append(_v) elif isinstance(_v, dict): - getattr(self, k).append(klass(allow_new_fields=self.allow_new_fields,**_v)) + getattr(self, k).append(klass(allow_new_fields=self.allow_new_fields, **_v)) else: self._invalid_field(k) self.clean() @@ -179,7 +179,6 @@ def _request(self, http_method, stem, data={}, params={}): data = data.replace('\\n', ' ') kwargs = { 'params': params, - 'data': data, 'headers': self.headers, 'auth': (self.username, self.password), 'proxies': self.proxies, @@ -190,6 +189,7 @@ def _request(self, http_method, stem, data={}, params={}): if http_method == 'GET': resp = requests.get(url, **kwargs) elif http_method == 'POST': + kwargs.update({'data': data}) resp = requests.post(url, **kwargs) except (requests.exceptions.ConnectionError, requests.exceptions.SSLError, requests.exceptions.HTTPError, requests.exceptions.Timeout) as e: self.logger.warning(e) @@ -307,7 +307,7 @@ class AvalaraValidationException(AvalaraException): class AvalaraServerNotReachableException(AvalaraBaseException): """Raised when the AvaTax service is unreachable for any reason and no response is received""" - + def __init__(self, request_exception, *args, **kwargs): self.request_exception = request_exception @@ -376,7 +376,6 @@ class Document(AvalaraBase): CANCEL_ADJUSTMENT_CANCELED = 'AdjustmentCanceled' CANCEL_CODES = (CANCEL_POST_FAILED, CANCEL_DOC_DELETED, CANCEL_DOC_VOIDED, CANCEL_ADJUSTMENT_CANCELED) - _fields = ['DocType', 'DocId', 'DocCode', 'DocDate', 'CompanyCode', 'CustomerCode', 'Discount', 'Commit', 'CustomerUsageType', 'PurchaseOrderNo', 'ExemptionNo', 'PaymentDate', 'ReferenceCode', 'PosLaneCode', 'Client'] _contains = ['Lines', 'Addresses'] # the automatic parsing in `def update` doesn't work here, but its never invoked here _has = ['DetailLevel', 'TaxOverride'] @@ -601,7 +600,7 @@ class TaxOverride(AvalaraBase): OVERRIDE_AMOUNT = 'TaxAmount' OVERRIDE_DATE = 'TaxDate' OVERRIDE_EXEMPT = 'Exemption' - OVERRIDE_TYPES = ( OVERRIDE_NONE, OVERRIDE_AMOUNT, OVERRIDE_DATE, OVERRIDE_EXEMPT ) + OVERRIDE_TYPES = (OVERRIDE_NONE, OVERRIDE_AMOUNT, OVERRIDE_DATE, OVERRIDE_EXEMPT) _fields = ['TaxOverrideType', 'TaxAmount', 'TaxDate', 'Reason'] @staticmethod From f95aa0c335b83ce3ac7ace86e76e1e7738efc79e Mon Sep 17 00:00:00 2001 From: John Obelenus Date: Tue, 14 Nov 2017 17:02:01 -0500 Subject: [PATCH 2/2] Fix to import error bug --- pyavatax/__init__.py | 2 +- pyavatax/django_integration.py | 6 ++---- requirements.txt | 1 + setup.py | 3 ++- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyavatax/__init__.py b/pyavatax/__init__.py index 0d2be47..e4d91cb 100644 --- a/pyavatax/__init__.py +++ b/pyavatax/__init__.py @@ -1,4 +1,4 @@ -VERSION = (1, 3, 9) +VERSION = (1, 3, 10) def get_version(): diff --git a/pyavatax/django_integration.py b/pyavatax/django_integration.py index 38f16f9..c9d689e 100644 --- a/pyavatax/django_integration.py +++ b/pyavatax/django_integration.py @@ -1,8 +1,5 @@ -from django.utils import timezone - - class MockDjangoRecorder(object): - + @staticmethod def failure(doc, response): pass @@ -15,6 +12,7 @@ def success(doc): def get_django_recorder(): try: import django + from django.utils import timezone from django.conf import settings from pyavatax.models import AvaTaxRecord except ImportError: diff --git a/requirements.txt b/requirements.txt index 599240b..648346c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ pytest==2.6.4 testfixtures==4.1.2 Sphinx==1.1.3 simplejson==3.3.0 +twine==1.9.1 diff --git a/setup.py b/setup.py index db587c5..e317049 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ #! /usr/bin/env python from setuptools import setup, find_packages # python setup.py sdist -# python setup.py sdist bdist_wininst upload +# python setup.py sdist bdist_wininst +# twine upload dist/* version = __import__('pyavatax').__version__