Skip to content

Commit bbd50d5

Browse files
committed
Tidy up some constant values
1 parent cfdf0f9 commit bbd50d5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

skpy/chat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def getMsgs(self):
7474
def createRaw(self, msg):
7575
# All fields except timezone are required; 1418 = desktop client.
7676
client = ("os=Windows; osVer=10; proc=x86; lcid=en-US; deviceType=1; country=US; "
77-
"clientName=skype4life; clientVer=1418/9.99.0.999//skype4life")
77+
"clientName=skype4life; clientVer={0}//skype4life").format(SkypeConnection.SKYPE_CLIENT)
7878
resp = self.skype.conn("POST", "{0}/users/ME/conversations/{1}/messages"
7979
.format(self.skype.conn.msgsHost, self.id),
8080
auth=SkypeConnection.Auth.RegToken, headers={"ClientInfo": client}, json=msg)

skpy/conn.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ def externalCall(cls, method, url, codes=(200, 201, 204, 207), **kwargs):
144144
API_DIRECTORY = "https://skypegraph.skype.com/v2.0/search/"
145145
# Version doesn't seem to be important, at least not for what we need.
146146
API_CONFIG = "https://a.config.skype.com/config/v1"
147+
147148
USER_AGENT = "SkPy"
149+
USER_AGENT_BROWSER = ("Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) "
150+
"Chrome/33.0.1750.117 Safari/537.36")
148151
SKYPE_CLIENT = "1418/9.99.0.999"
149152

150153
attrs = ("userId", "tokenFile", "connected", "guest")
@@ -822,10 +825,8 @@ def auth(self, url, name):
822825
"""
823826
urlId = url.split("/")[-1]
824827
# Pretend to be Chrome on Windows (required to avoid "unsupported device" messages).
825-
agent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " \
826-
"Chrome/33.0.1750.117 Safari/537.36"
827828
cookies = self.conn("GET", "{0}/{1}".format(SkypeConnection.API_JOIN, urlId),
828-
headers={"User-Agent": agent}).cookies
829+
headers={"User-Agent": SkypeConnection.USER_AGENT_BROWSER}).cookies
829830
ids = self.conn("POST", "{0}/api/v2/conversation/".format(SkypeConnection.API_JOIN),
830831
json={"shortId": urlId, "type": "wl"}).json()
831832
token = self.conn("POST", "{0}/api/v1/users/guests".format(SkypeConnection.API_JOIN),

0 commit comments

Comments
 (0)