Git Product home page Git Product logo

lime-py-api's People

Contributors

dimitripapadopoulos avatar fabiore avatar gurkanboll avatar taishinet avatar wozhub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lime-py-api's Issues

how can i add Participant in central participant database by API?

when i use api function "cpd_importParticipants" to add Participant in central participant database, the result seem to be wrong? who can help me ? i use lime-py-api and create a add_participants method like this:
def add_participants(self, email, firstname, lastname):
data = """ { "id" : 1,
"method":"cpd_importParticipants",
"params": { "sSessionKey": "%s",
"aParticipants": {"email":"%s", "firstname":"%s", "lastname":"%s"}
} } """ % (self.session_key, email, firstname, lastname)
return self._getJSON(data)

for excemple:
aa.add_participants("[email protected]", "jim", "tom")
but the result return add three add participants in in the central participant database ,but the info is :
firstname lastname email
a a a
j j j
t t t

fix array of list_participants

The list_participants function should return 'completed', 'invited', 'reminded', 'usesleft' but it doesn't, aConditions is probably defined wrong in (i know that in limesurvey.py it is defined as array(), but array() is not defined in python), maybe @Shnoulle knows how to properly call the function

def list_participants(self, sid, iStart=0, iLimit=1000000, bUnused='true', aAttributes='true', aConditions=['completed', 'invited', 'reminded', 'usesleft']):
data = """ { "id" : 1,
"method":"list_participants",
"params": { "sSessionKey": "%s",
"iSurveyID": %s,
"iStart": %s,
"iLimit": %s,
"bUnused": "%s",
"aAttributes": "%s",
"aConditions": "%s"
} } """ % (self.session_key, sid, iStart, iLimit, bUnused, aAttributes, aConditions)
return self._getJSON(data)['result']

export_res shouldn't be a dict

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

limesurvey.py

Error when running limesurvey.py from import

Error:

Traceback (most recent call last):
File "example.py", line 13, in
lime = Api(url, user, key)
File "/Users/user/Documents/python/lime-py-api/limesurvey.py", line 21, in init
self.session_key = self._getJSON(data)['result']
TypeError: 'NoneType' object has no attribute 'getitem'

error with export_responses function

Traceback (most recent call last):
File "example.py", line 21, in
export_res_token = lime.export_responses(sid, token)
File "/home/p/programming/python/lime-py-api/limesurvey.py", line 126, in export_responses
out = b64decode(self._getJSON(data)['result']).decode('utf-8')
File "/usr/lib/python2.7/base64.py", line 75, in b64decode
return binascii.a2b_base64(s)
TypeError: a2b_base64() argument 1 must be string or buffer, not dict

when I add print self._getJSON(data)['result']) before line 126 in limesruvey.py I get:
{u'status': u'Language code not found for this survey.'}

any ideas, how to fix this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.