leogomezz4t / PyTextNow_API

Python texting API utilizing TextNow API
MIT License
69 stars 42 forks source link

Can't use `send_sms` with a body that includes the newline ('\n') character #21

Closed evanye closed 3 years ago

evanye commented 3 years ago

title says it all.

client.send_sms(number, "a" + "\n" + b)

yields

pytextnow.TNAPI.FailedRequest: Could not send message. server returned a Client error. Request Failed. Try resetting your authentication with client.auth_reset()
Status Code: 400
bryanperez43 commented 3 years ago

yes it is possible to include newlines when sending messages. I would suggest using f-strings when composing a message since its easy to format string and faster than using the + method

msg = f'a \\n {b}'

@leogomezz4t i think this issue can be closed

leogomezz4t commented 3 years ago

thank you @bryanperez43. I think to add a newline character you have to use \\n instead of \n

evanye commented 3 years ago

Thanks for the workaround! Slightly concerned that there might be some vulnerability here involving unescaped characters, but not sure that folks care since it's a personal project. Don't think I care :)