12
12
import requests
13
13
from bs4 import BeautifulSoup
14
14
15
- from .core import SkypeApiException , SkypeAuthException , SkypeEnum , SkypeObj , SkypeRateLimitException
15
+ from .core import SkypeApiException , SkypeAuthException , SkypeEnum , SkypeObj , SkypeRateLimitException , \
16
+ SkypeTokenException
16
17
17
18
18
19
class SkypeConnection (SkypeObj ):
@@ -310,9 +311,9 @@ def readTokenFromStr(self, tokens):
310
311
skypeExpiry = datetime .fromtimestamp (int (skypeExpiry ))
311
312
regExpiry = datetime .fromtimestamp (int (regExpiry ))
312
313
except ValueError :
313
- raise SkypeAuthException ("Token file is malformed" )
314
+ raise SkypeTokenException ("Token file is malformed" )
314
315
if datetime .now () >= skypeExpiry :
315
- raise SkypeAuthException ("Token file has expired" )
316
+ raise SkypeTokenException ("Token file has expired" )
316
317
self .userId = user
317
318
self .tokens ["skype" ] = skypeToken
318
319
self .tokenExpiry ["skype" ] = skypeExpiry
@@ -333,12 +334,12 @@ def readToken(self):
333
334
.SkypeAuthException: if the token file cannot be used to authenticate
334
335
"""
335
336
if not self .tokenFile :
336
- raise SkypeAuthException ("No token file specified" )
337
+ raise SkypeTokenException ("No token file specified" )
337
338
try :
338
339
with open (self .tokenFile , "r" ) as f :
339
340
tokens = f .read ()
340
341
except OSError :
341
- raise SkypeAuthException ("Token file doesn't exist or not readable" )
342
+ raise SkypeTokenException ("Token file doesn't exist or not readable" )
342
343
self .readTokenFromStr (tokens )
343
344
344
345
def writeTokenToStr (self ):
@@ -384,7 +385,7 @@ def verifyToken(self, auth):
384
385
if auth in (self .Auth .SkypeToken , self .Auth .Authorize ):
385
386
if "skype" not in self .tokenExpiry or datetime .now () >= self .tokenExpiry ["skype" ]:
386
387
if not hasattr (self , "getSkypeToken" ):
387
- raise SkypeAuthException ("Skype token expired, and no password specified" )
388
+ raise SkypeTokenException ("Skype token expired, and no password specified" )
388
389
self .getSkypeToken ()
389
390
elif auth == self .Auth .RegToken :
390
391
if "reg" not in self .tokenExpiry or datetime .now () >= self .tokenExpiry ["reg" ]:
@@ -489,7 +490,7 @@ def getSkypeToken(self):
489
490
Raises:
490
491
.SkypeAuthException: if credentials were never provided
491
492
"""
492
- raise SkypeAuthException ("No username or password provided, and no valid token file" )
493
+ raise SkypeTokenException ("No username or password provided, and no valid token file" )
493
494
494
495
def refreshSkypeToken (self ):
495
496
"""
0 commit comments