Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit f6381de

Browse files
committed
Use patched ASM URL for files only as fallback
Fixes #260.
1 parent 5b843a7 commit f6381de

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

skpy/msg.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from bs4 import BeautifulSoup, Tag
88

9-
from .core import SkypeObj, SkypeEnum
9+
from .core import SkypeObj, SkypeEnum, SkypeApiException
1010
from .util import SkypeUtils
1111
from .conn import SkypeConnection
1212

@@ -593,16 +593,24 @@ def contentToFields(cls, content):
593593

594594
@property
595595
def urlContent(self):
596+
return "{0}/views/{1}".format(self.file.urlFull, self.contentPath) if self.file else None
597+
598+
@property
599+
def urlContentAsm(self):
596600
return "{0}/views/{1}".format(self.file.urlAsm, self.contentPath) if self.file else None
597601

598602
@property
599603
@SkypeUtils.cacheResult
600604
def fileContent(self):
601-
if self.file:
605+
if not self.file:
606+
return None
607+
try:
602608
return self.skype.conn("GET", self.urlContent,
603609
auth=SkypeConnection.Auth.Authorize).content
604-
else:
605-
return None
610+
except SkypeApiException:
611+
# Try retrieving via the patched ASM URL instead.
612+
return self.skype.conn("GET", self.urlContentAsm,
613+
auth=SkypeConnection.Auth.Authorize).content
606614

607615
@property
608616
def html(self):

0 commit comments

Comments
 (0)