Pregunta

I am accessing the class from the code api_service.py, which can be found here. When I call the first function, I have no problem, because no variables are passed:

from api_service import ApiService
import json

def main():

    api_key = *removed*
    access_token = *removed*

    calling = ApiService(api_key,access_token)
    survey_list = calling.get_survey_list()

But when I use the same type of routine as above to call a function from ApiService that requires a variable, I'm told that I should pass an object.

    survey_details = calling.get_survey_details("1234")
    survey_details = json.loads(json.dumps(survey_details))
    print survey_details

The specific error message:

{u'status': 3, u'errmsg': u"Value '1234' for field '_data' is not of type object"}

Details for the get_survey_details aspect of the SurveyMonkey API are here, although I think a python-guru can solve this without knowing about the API.

¿Fue útil?

Solución

This is a javascript/json object:

{field:'value'}

You have passed a string which, doesn't count as an "object" for these purposes.

Note that the error message is being generated by the service you are accessing. This question would be better directed to the creator of the service.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top