mosotieno
(mosotieno)
October 20, 2025, 7:02pm
1
Am having trouble with Export function in ssaw. I have created reprex here. Any assistance please?
from ssaw import Client, models, ExportApi, QuestionnairesApi
url = 'https://mosotieno-demo.mysurvey.solutions/'
api_user = 'mosetest'
api_pass = 'Testing@2025'
workspace = 'test'
client = Client(url=url, api_user=api_user, api_password=api_pass, workspace=workspace)
for q in QuestionnairesApi(client).get_list():
print(q.id) # Works!
export = models.ExportJob(q, export_type='STATA') # Works!
print(export) # Works!
ExportApi(client).start(export, wait=True) # Error: TypeError: Object of type Questionnaire is not JSON serializable
requirements.txt
annotated-types==0.7.0
certifi==2025.10.5
charset-normalizer==3.4.4
graphql-core==3.2.6
idna==3.11
pydantic==2.12.3
pydantic_core==2.41.4
requests==2.32.5
sgqlc==17.1
ssaw==0.7
typing-inspection==0.4.2
typing_extensions==4.15.0
urllib3==2.5.0
zurab
(zurab)
November 3, 2025, 8:15pm
2
I just tried to run your example (haven’t worked with this code for years, so may have a different environment than you), encountered other issues related to the version of pydantic - there was a major switch between v1 and v2 since this code was written, I have a draft version where I updated the syntax to switch to the v2 and if using that my requests went through … you must’ve seen export processes started on Friday, right?
Are you still getting the same error? what happens if you use pydantic==1.7.2?
mosotieno
(mosotieno)
November 4, 2025, 5:35am
3
Yes, the export started but there were errors as shown in the picture above.
I have not tried pydantic==1.7.2. Let me just do that right away!
mosotieno
(mosotieno)
November 4, 2025, 5:47am
5
It works with pydantic==1.7.2
annotated-types==0.7.0
certifi==2025.10.5
charset-normalizer==3.4.4
graphql-core==3.2.6
idna==3.11
pydantic==1.7.2
pydantic_core==2.41.4
requests==2.32.5
sgqlc==17.1
ssaw==0.7
typing-inspection==0.4.2
typing_extensions==4.15.0
urllib3==2.5.0
from ssaw import Client, models, ExportApi, QuestionnairesApi
url = 'https://mosotieno-demo.mysurvey.solutions/'
api_user = 'mosetest'
api_pass = 'Testing@2025'
workspace = 'test'
client = Client(url=url, api_user=api_user, api_password=api_pass, workspace=workspace)
questionnaire_id = []
for q in QuestionnairesApi(client).get_list():
print(q.id) # Works!
questionnaire_id.append(q.id)
latest_q = questionnaire_id[-1]
export = models.ExportJob(questionnaire_id=latest_q, export_type='STATA') # Works!
print(export) # Works!
ExportApi(client).start(export, wait=True)
ExportApi(client, workspace=workspace).get(
questionnaire_identity=latest_q,
export_type='STATA',
show_progress=True,
generate=True,
export_path='./data'
) # Download the exported data to the specified path
print("Download completed successfully!")
zurab
(zurab)
November 5, 2025, 8:41pm
6
I just uploaded version 0.8 of the ssaw package with the latest pydantic and python versions (3.10-3.14) tested. You don’t need to change anything in your setup since it works now, but if decide to update, should be fine too.