Vi använder kakor för att göra LingQ bättre. Genom att besöka sajten, godkänner du vår cookie policy.

it   Italien

Problems updating lesson content using python

February 2018

Dear Developers,

I try to update/modify the content of my lessons using the "request" library of python. Some of the fields like "level" or 'originalUrl' are "null" when I check the lesson details using the GET statement. When I try to send the exact same data back using the PUT statement it fails. The server seems to process the data, but it seems not to be happy about the content of the "null" value. The server respond is: u'originalUrl': [u'This field may not be null.']. I tried to send an empty string, answer: [u'This field may not be blank.']. I removed the entry from the dictionary, answer: [u'This field is required.'].

The call looks like this: resp = requests.put('https://www.lingq.com/api/v2/ru/lessons/(ContentID)/', json=data, headers={'Authorization': 'Token ' + API_KEY})

data={"title": "08150815", "originalUrl": null, ... , "price": 0}

What can I do to convince the server to keep some entry without any value e.g. "null"?