Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How to get the Limesurvey API working in Python

  • gracylayla
  • gracylayla's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago - 5 years 6 months ago #174102 by gracylayla
I'm trying to get the session key from the Limesurvey API using Selenium with Python 2.7 ( mindmajix.com/selenium-with-python-training ) and I'm not getting any results after running my code. I've followed the example in the documentation but still get an error
Code:
<p>Error: <type 'exceptions.ValueError'></p>
. My code is as follows:
Code:
import urllib
import urllib2
import json
import sys
 
req = urllib2.Request(url='https://testone.limequery.com/index.php/admin/remotecontro,\
                              data='{\"method\":\"get_session_key\",\"params\":[\"admin\",\"Password\"],\"id\":1}')
req.add_header('content-type', 'application/json')
req.add_header('connection', 'Keep-Alive')
 
try:    
    f = urllib2.urlopen(req)
    myretun = f.read()
    j=json.loads(myretun)
    print (j['result'])
except :
        e = sys.exc_info()[0]
        print ( "<p>Error: %s</p>" % e )

Removing the try catch gives me the error ValueError: No JSON object could be decoded
Last edit: 5 years 6 months ago by DenisChenu. Reason: Remove direct near spam link
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174106 by tpartner
I know little about Python but it seems to me that the path to remotcontrol is incorrect.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174121 by DenisChenu
Replied by DenisChenu on topic How to get the Limesurvey API working in Python

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose