Browse Source

Merge branch 'babolivier/py3-submit-token' into babolivier/py3-bind

Brendan Abolivier 4 years ago
parent
commit
db22f438b4
2 changed files with 4 additions and 9 deletions
  1. 2 8
      sydent/sms/openmarket.py
  2. 2 1
      sydent/util/stringutils.py

+ 2 - 8
sydent/sms/openmarket.py

@@ -89,14 +89,8 @@ class OpenMarketSMS:
 
         # Make sure username and password are bytes otherwise we can't use them with
         # b64encode.
-        username = self.sydent.cfg.get('sms', 'username')
-        password = self.sydent.cfg.get('sms', 'password')
-
-        if not isinstance(username, bytes):
-            username = username.encode("UTF-8")
-
-        if not isinstance(password, bytes):
-            password = password.encode("UTF-8")
+        username = self.sydent.cfg.get('sms', 'username').encode("UTF-8")
+        password = self.sydent.cfg.get('sms', 'password').encode("UTF-8")
 
         b64creds = b64encode(b"%s:%s" % (username, password))
         headers = Headers({

+ 2 - 1
sydent/util/stringutils.py

@@ -25,7 +25,8 @@ def is_valid_client_secret(client_secret):
 
     :param client_secret: The client_secret to validate
     :type client_secret: unicode
-    :returns: Whether the client_secret is valid
+
+    :return: Whether the client_secret is valid
     :rtype: bool
     """
     return client_secret_regex.match(client_secret) is not None