python xmpp wokkel JID escaping

225 Views Asked by At

After a painful search for Python XMPP library to use for XEP 060 I finally decided on wokkel and twisted.

However, they cannot understand the simple JID escaping of XEP-106

I am trying to pass username as an email address so I escape it like this admin\[email protected] where the username is [email protected]

The program complains about invalid character in username Should I try another library that does work? and has documentation. I would really appreciate the help.

1

There are 1 best solutions below

1
On BEST ANSWER

This is just a guess, but if you have the username or JID in a string, and are specifying it like:

"admin\[email protected]"

If so, Python treats backslash escape codes specially. Change it to a double backslash to actually insert a single backslash into the string:

"admin\\[email protected]"