horacioibrahim / iugu-python

Iugu python client for Iugu API
Apache License 2.0
12 stars 10 forks source link

the JSON object must be str, not 'bytes' #8

Closed fellipeh closed 9 years ago

fellipeh commented 9 years ago

Hello,

When I create a simple slip_bank charge show me this error:

Environment:

Request Method: POST Request URL: http://local.enota.com.br:8000/cursos/matricular/confirmar/

Django Version: 1.8.1 Python Version: 3.4.2 Installed Applications: ('django_extensions', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'django_filters', 'social.apps.django_app.default', 'bootstrap3', 'crispy_forms', 'compressor', 'braces', 'accounts', 'core', 'cursos', 'assinatura', 'debug_toolbar') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'core.context_middleware.JSONMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware')

Traceback: File "/Users/fellipeh/.virtualenvs/enota/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response

  1. response = wrapped_callback(request, _callback_args, *_callback_kwargs) File "/Users/fellipeh/.virtualenvs/enota/lib/python3.4/site-packages/django/views/decorators/http.py" in inner
  2. return func(request, _args, *_kwargs) File "/Users/fellipeh/.virtualenvs/enota/lib/python3.4/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  3. return view_func(request, _args, *_kwargs) File "/Users/fellipeh/Developer/django/enota/assinatura/views.py" in confirma_checkout_curso
  4. payment = pagar_curso(request, id_user=request.user.id, id_curso=curso_id) File "/Users/fellipeh/.virtualenvs/enota/lib/python3.4/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  5. return view_func(request, _args, *_kwargs) File "/Users/fellipeh/Developer/django/enota/assinatura/views.py" in pagar_curso
  6. charge = client.create_charge(u.email, item) File "/Users/fellipeh/.virtualenvs/enota/lib/python3.4/site-packages/iugu_python-0.9.6-py3.4.egg/iugu/merchant.py" in create_charge
  7. results = self.__conn.post(urn, data) File "/Users/fellipeh/.virtualenvs/enota/lib/python3.4/site-packages/iugu_python-0.9.6-py3.4.egg/iugu/base.py" in post
  8. return self.__validation(response) File "/Users/fellipeh/.virtualenvs/enota/lib/python3.4/site-packages/iugu_python-0.9.6-py3.4.egg/iugu/base.py" in __validation
  9. results = json_load(response) File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/json/init.py" in load
  10. parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, kw) File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/json/init**.py" in loads
  11. s.class.name))

Exception Type: TypeError at /cursos/matricular/confirmar/ Exception Value: the JSON object must be str, not 'bytes'

horacioibrahim commented 9 years ago

Hi @fellipeh! I ran the tests with success. I thought in the possibility of changes from API but not yet. However i didn't done tests this lib with python 3+.

horacioibrahim commented 9 years ago

Or better. This lib not support python 3 or 3+ ;). All right?

horacioibrahim commented 9 years ago

The lib not supports py3000.