TaiSHiNet/lime-py-api

export_res shouldn't be a dict

Opened this issue · 0 comments

Hello, I'm facing an issue trying the current library for lime-py-api

i had to import manually the code with
!git clone https://github.com/TaiSHiNet/lime-py-api
as it seems not to be packaged and available in pip,

however, after running the content locally in google colab, i had several issues

from the current provided example:

export_res_token = lime.export_responses_by_token(sid, token)

# Insert in db
export_res = export_res_token

## Add Response
response_to_add = {}

# export_res export_res = lime.export_responses_by_token('999729', 'qdgb2bkiqgqwtvu')
if export_res is not None:
    decoded_string = base64.b64decode(export_res)
    with open("Output.json", "w") as text_file:
        text_file.write(decoded_string)

first i had an issue with the endpoint : export_responses_by_token

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-18-918f6135f6e4>](https://localhost:8080/#) in <module>
     18 
     19 # GET data - token
---> 20 export_res_token = lime.export_responses_by_token(sid, token)
     21 
     22 # Insert in db

AttributeError: 'LimeSurvey' object has no attribute 'export_responses_by_token

then here the new issue about a misformat or wrong type of object to be decode

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-42-7f8ca51a134c>](https://localhost:8080/#) in <module>
     39 # export_res export_res = lime.export_responses_by_token('999729', 'qdgb2bkiqgqwtvu')
     40 if export_res is not None:
---> 41     decoded_string = base64.b64decode(export_res)
     42     with open("Output.json", "w") as text_file:
     43         text_file.write(decoded_string)

1 frames
[/usr/lib/python3.8/base64.py](https://localhost:8080/#) in _bytes_from_decode_data(s)
     43         return memoryview(s).tobytes()
     44     except TypeError:
---> 45         raise TypeError("argument should be a bytes-like object or ASCII "
     46                         "string, not %r" % s.__class__.__name__) from None
     47 

TypeError: argument should be a bytes-like object or ASCII string, not 'dict'

could you please provide help with this ?

Thank you

Amaury