import requestsdefanalyze_sentiment(api_key,text): api_url ='https://emotionalclassification-mixederapi.mixeder.com/' params ={"key": api_key,"text": text,}try: response = requests.get(api_url, params=params) response.raise_for_status() data = response.json()print("Sentiment analysis result:", data["analysis"])return data["analysis"]except requests.exceptions.RequestException as e:print("Error during sentiment analysis:", e)raise# 使用例analyze_sentiment("your-api-key", "I am very happy with this service!")