diff --git a/.gitignore b/.gitignore index d57811a..a04cdb9 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,5 @@ ENV/ .ropeproject example/teste.py + +.idea/* diff --git a/cieloApi3/objectJSON.py b/cieloApi3/objectJSON.py index 49bcc04..dc657c5 100644 --- a/cieloApi3/objectJSON.py +++ b/cieloApi3/objectJSON.py @@ -1,5 +1,7 @@ import json +from future.utils import integer_types + class ObjectJSON(object): @@ -58,7 +60,8 @@ def remove_none_dict(obj): retorno = {} for chave in obj: valor = obj[chave] - if valor or isinstance(valor, (int, long, float, complex)): + types = integer_types + (float, complex) + if valor or isinstance(valor, types): retorno[chave] = remove_none(valor) return retorno diff --git a/cieloApi3/request/base.py b/cieloApi3/request/base.py index f94c0fa..3b8cd4d 100644 --- a/cieloApi3/request/base.py +++ b/cieloApi3/request/base.py @@ -1,5 +1,6 @@ import uuid, json +from future.utils import raise_with_traceback from requests import Request, Session class Base(object): @@ -51,6 +52,6 @@ def send_request(self, method, uri, data=None, params=None): data_send = json.loads(body or 'null') - raise Exception, '\r\n%s\r\nMethod: %s\r\nUri: %s\r\nData: %s' % (''.join(errors), method, response.url, json.dumps(data_send, indent=2)) + raise_with_traceback(Exception('\r\n%s\r\nMethod: %s\r\nUri: %s\r\nData: %s' % (''.join(errors), method, response.url, json.dumps(data_send, indent=2)))) return answers diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0442a2b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +appdirs==1.4.3 +future==0.16.0 +packaging==16.8 +pyparsing==2.2.0 +requests==2.13.0 diff --git a/setup.py b/setup.py index e7a6b47..759f6c6 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ url='https://github.com/thiago-Malaca/API-3.0-Python', keywords='api3.0 cielo python sdk ecommerce', packages=find_packages(), - install_requires=['requests'], + install_requires=['requests', 'future'], license='MIT', classifiers=( # 'Development Status :: 5 - Production/Stable', @@ -37,6 +37,8 @@ # 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', ) )