Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export_res shouldn't be a dict #8

Open
AmauryVanEspen opened this issue Mar 7, 2023 · 0 comments
Open

export_res shouldn't be a dict #8

AmauryVanEspen opened this issue Mar 7, 2023 · 0 comments

Comments

@AmauryVanEspen
Copy link

AmauryVanEspen commented Mar 7, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant