From f1e3656d774f16f7398ed95f52b7aaa2dd26e373 Mon Sep 17 00:00:00 2001 From: Abram Clark Date: Mon, 9 Apr 2018 13:27:33 -0700 Subject: [PATCH 1/3] Fix for sending delivery and zip4 verification in the same request --- easypost/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/easypost/__init__.py b/easypost/__init__.py index 74263d5e..59f503e9 100644 --- a/easypost/__init__.py +++ b/easypost/__init__.py @@ -628,12 +628,11 @@ def create(cls, api_key=None, verify=None, verify_strict=None, **params): if verify or verify_strict: verify = verify or [] verify_strict = verify_strict or [] - url += "?" - for param in verify: - url += "verify[]={0}".format(param) - for param in verify_strict: - url += "verify_strict[]={0}".format(param) + url += '?' + '&'.join( + ['verify[]=' + param for param in verify] + + ['verify_strict[]=' + param for param in verify_strict] + ) wrapped_params = {cls.class_name(): params} response, api_key = requestor.request('post', url, wrapped_params) From 8d0e25cbe934546e523b72f7253d217261ddd19a Mon Sep 17 00:00:00 2001 From: Abram Clark Date: Wed, 11 Apr 2018 13:34:07 -0700 Subject: [PATCH 2/3] Switched to .format(), moved arg initialization to function params --- easypost/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/easypost/__init__.py b/easypost/__init__.py index 59f503e9..ef46b9f5 100644 --- a/easypost/__init__.py +++ b/easypost/__init__.py @@ -621,17 +621,14 @@ def delete(self, **params): class Address(AllResource, CreateResource): @classmethod - def create(cls, api_key=None, verify=None, verify_strict=None, **params): + def create(cls, api_key=None, verify=[], verify_strict=[], **params): requestor = Requestor(api_key) url = cls.class_url() if verify or verify_strict: - verify = verify or [] - verify_strict = verify_strict or [] - url += '?' + '&'.join( - ['verify[]=' + param for param in verify] + - ['verify_strict[]=' + param for param in verify_strict] + ['verify[]={0}'.format(opt) for opt in verify] + + ['verify_strict[]={0}'.format(opt) for opt in verify_strict] ) wrapped_params = {cls.class_name(): params} From 8ae02959a45ae25cd9cdcfc150f8bf51e456307f Mon Sep 17 00:00:00 2001 From: Abram Clark Date: Thu, 12 Apr 2018 15:05:02 -0700 Subject: [PATCH 3/3] Fixed initialization of verify and verify_strict params --- easypost/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/easypost/__init__.py b/easypost/__init__.py index ef46b9f5..7d37f366 100644 --- a/easypost/__init__.py +++ b/easypost/__init__.py @@ -621,11 +621,13 @@ def delete(self, **params): class Address(AllResource, CreateResource): @classmethod - def create(cls, api_key=None, verify=[], verify_strict=[], **params): + def create(cls, api_key=None, verify=None, verify_strict=None, **params): requestor = Requestor(api_key) url = cls.class_url() if verify or verify_strict: + verify = verify or [] + verify_strict = verify_strict or [] url += '?' + '&'.join( ['verify[]={0}'.format(opt) for opt in verify] + ['verify_strict[]={0}'.format(opt) for opt in verify_strict]