LingQ'yu daha iyi hale getirmek için çerezleri kullanıyoruz. Siteyi ziyaret ederek, bunu kabul edersiniz: cookie policy.

tr   Türkiye

Response 500

February 05 at 06:58

It returns <response 500>, it was working perfectly fine, before the new update.

What is the mistake? Can someone correct it?

import requests

API_KEY = "myapikey"

with open("foobar.txt", 'r', encoding="utf8", errors='ignore') as f:

words = f.read()

with open("foobar.mp3", 'rb') as f:

mp3data = f.read()

filename = "test"

mp3file = {"audio": (f"{filename}.mp3", mp3data)}

data = {"title": f"{filename}",

"text": f"{words}",

"tags": ["saveddoc", "mp3"],

"collection": "collection_number"}

resp = requests.post('https://www.lingq.com/api/v2/en/lessons/',

data=data, headers={'Authorization': 'Token ' + API_KEY})

#data=data, files=mp3file, headers={'Authorization': 'Token ' + API_KEY})