Closed dcaprita closed 6 years ago
Thanks for your input.
It is rather peculiar, as client_key_digest
should be a byte string so accessing element by index returns single byte which is a valid argument for XOR operator. In your case it seems like the client_key_digest
is a unicode string.
A long shot, but is the PASSWORD
string in your config.py prefixed with b, i.e. is it:
PASSWORD = b"my password"
and not
PASSWORD= 'my password'
?
It was the python version (Python 2.7.14). If I run it with python3 (as you specified in the shebang) it works ok. Switched from an older Huawei e5776 that didn't used SCRAM authentication and this is exactly was I looking for.
Thank you for you great job!
Ah yes, just tried it with Python 2.7.12 and indeed it handles bytestring differently:
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
>>> a=b"test"
>>> a[0]^a[1]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for ^: 'str' and 'str'
whilst with Python 3.5:
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
>>> a=b"test"
>>> a[0]^a[1]
17
I just put a note about this requirement in README - should have added it in a first place. Sorry!
Thank you - I'm glad someone found this useful :)
Fix "TypeError: unsupported operand type(s) for ^: 'str' and 'str'"
PS: Tested on Huawei B525s-23a and works ok. I use it as a sms gateway (api/sms/send-sms) to send notifications from my home automation system.