unicode sms problem HELP
Hi, i am running a very simple sms API code from Vonage(nexmo) to send bulk sms .
Code is working fine with normal text but when i try to send in Greek ( Cyrilic alphabet ) i get jiberish text like : " ????? ????? ???? " sign that unicode is not automatically activated in the code .I have tried "pip install unicode " then "import unicode" but pycharm error says can't find module named unicode i have tried to "type": unicode , but error that no module unicode istalled
Here is my code :
import csv
import vonage
client = vonage.Client(key="226xxxx", secret="Dg9xxxxxxx")
sms = vonage.Sms(client)
def get_mobile_nos_from_csv_file():
with open('data.csv') as csvfile:
mobile_nos = []
reader = csv.DictReader(csvfile)
for row in reader:
mobile_nos.append(row['mobile'])
print("collected All Mobile No's From Csv File !!!")
return mobile_nos
def send_msg_to_mobile_no(mobile, msg="Wελcομε το Ζιμα Hοτελ Ζακιντοσ"):
print("sending msg to mobile %s msg %s" % (mobile, msg))
responseData = sms.send_message(
{
"from": "Zima Hotel",
"to": str(mobile),
"text": msg,
}
)
if responseData["messages"][0]["status"] == "0":
print("Msg to %s sent successfully." % (str(mobile)))
else:
print(f"Message to {str(mobile)} failed with error: {responseData['messages'][0]['error-text']}")
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
mobile_nos = get_mobile_nos_from_csv_file()
for mobile in mobile_nos:
send_msg_to_mobile_no(mobile)
Please sign in to leave a comment.