- Posts: 1
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
5 years 7 months ago - 5 years 7 months ago #174102
by gracylayla
How to get the Limesurvey API working in Python was created 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
. My code is as follows:
Removing the try catch gives me the error ValueError: No JSON object could be decoded
Code:
<p>Error: <type 'exceptions.ValueError'></p>
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 7 months ago by DenisChenu. Reason: Remove direct near spam link
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
5 years 7 months ago #174106
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic How to get the Limesurvey API working in Python
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13637
- Thank you received: 2491
5 years 7 months ago #174121
by DenisChenu
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.
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.