epayco / epayco-python

SDK para python pagos con tarjeta de credito,debito y cash
12 stars 12 forks source link

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) #2

Closed sairth19 closed 2 years ago

sairth19 commented 6 years ago

Hola Estoy experimentando este problema con la API que suministran. Estoy probando lo API y al momento de obtener la información de un cliente se dispara la excepción.

Intento hacer: >>> customer=objepayco.customer.get("nxjxzoFvaZ4yT3SDj") Y se lanza la excepción.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sairth19/projects/epayco_test/env/lib/python3.5/site-packages/pyepayco/resources.py", line 80, in get
    self.epayco.lang
  File "/home/sairth19/projects/epayco_test/env/lib/python3.5/site-packages/pyepayco/client.py", line 182, in request
    return response.json()
  File "/home/sairth19/projects/epayco_test/env/lib/python3.5/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Espero me puedan ayudar. Gracias!

sairth19 commented 6 years ago

El error es obtenido porque el método json espera contenido que pueda ser transformado a JSON, pero recibe es un HTML, ya que la url de la petición esta errada En la linea 74, del archivo resources.py cambiar: "payment/v1/customer/" + uid + "/",

por: "payment/v1/customer/"+ self.epayco.api_key +"/" + uid + "/",

y listo, el metodo funciona.

devepayco commented 5 years ago

Hola, @sairth19 este Issue ya fue resuelto. Por favor descargar la librería nuevamente. Le agradecemos amablemente por su reporte.

Akhilvis commented 4 years ago

Installed using pip and also upgraded using

pip install --upgrade pyepayco

. But still have the issue.What i found is that the fix in line 74 of

resources.py

is not reflected in my package ?

Gerson-epayco commented 2 years ago

Good Afternoon @Akhilvis

Install from Packages (Linux), Pyhton = 3.7


$ pip install epaycosdk

Install from Packages (Windows) Pyhton = 3.7


$ pip install epaycosdk-win