diff --git a/skpy/chat.py b/skpy/chat.py index 8b06447..48e4922 100644 --- a/skpy/chat.py +++ b/skpy/chat.py @@ -74,7 +74,7 @@ def getMsgs(self): def createRaw(self, msg): # All fields except timezone are required; 1418 = desktop client. client = ("os=Windows; osVer=10; proc=x86; lcid=en-US; deviceType=1; country=US; " - "clientName=skype4life; clientVer=1418/9.99.0.999//skype4life") + "clientName=skype4life; clientVer={0}//skype4life").format(SkypeConnection.SKYPE_CLIENT) resp = self.skype.conn("POST", "{0}/users/ME/conversations/{1}/messages" .format(self.skype.conn.msgsHost, self.id), auth=SkypeConnection.Auth.RegToken, headers={"ClientInfo": client}, json=msg) diff --git a/skpy/conn.py b/skpy/conn.py index a476571..19da8cc 100644 --- a/skpy/conn.py +++ b/skpy/conn.py @@ -144,7 +144,10 @@ def externalCall(cls, method, url, codes=(200, 201, 204, 207), **kwargs): API_DIRECTORY = "https://skypegraph.skype.com/v2.0/search/" # Version doesn't seem to be important, at least not for what we need. API_CONFIG = "https://a.config.skype.com/config/v1" + USER_AGENT = "SkPy" + USER_AGENT_BROWSER = ("Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/33.0.1750.117 Safari/537.36") SKYPE_CLIENT = "1418/9.99.0.999" attrs = ("userId", "tokenFile", "connected", "guest") @@ -822,10 +825,8 @@ def auth(self, url, name): """ urlId = url.split("/")[-1] # Pretend to be Chrome on Windows (required to avoid "unsupported device" messages). - agent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " \ - "Chrome/33.0.1750.117 Safari/537.36" cookies = self.conn("GET", "{0}/{1}".format(SkypeConnection.API_JOIN, urlId), - headers={"User-Agent": agent}).cookies + headers={"User-Agent": SkypeConnection.USER_AGENT_BROWSER}).cookies ids = self.conn("POST", "{0}/api/v2/conversation/".format(SkypeConnection.API_JOIN), json={"shortId": urlId, "type": "wl"}).json() token = self.conn("POST", "{0}/api/v1/users/guests".format(SkypeConnection.API_JOIN),